Israel was defeated at Ai after a breach regarding the things devoted to destruction Joshua 7:1. The LORD said Israel had sinned and taken some of the devoted things, so they could not stand before their enemies Joshua 7:11–12.
Joshua 7:1–5 reports an abrupt turn from victory to defeat. Although Israel as a whole is named, the text identifies Achan from Judah as the one who took items that had been set apart, and it says Yahweh’s anger was directed against Israel. Unaware of this hidden act, Joshua sends scouts from Jericho to Ai. This scene follows the fall of Jericho and the strict instruction that certain goods there were not for private taking (implied by the reference to “the devoted thing”). Joshua 7 opens a new problem by disclosing to the reader what Joshua and the army do not yet know: someone has violated the restriction.
Joshua 7:1–5 explains an unexpected military setback by first revealing a hidden breach. The narrator says “Israel” broke faith regarding “the devoted thing,” then identifies one person—Achan from Judah—as the one who took it (explicit textual claim).
A careful answer keeps the immediate passage, the book's argument, and the whole-Bible storyline together, so the question is answered in context instead of as a detached idea.
Start with Joshua 7:1, then read the surrounding section so the answer stays connected to the passage's flow.
1But the children of Israel committed a trespass in the devoted thing; for Achan, the son of Carmi, the son of Zabdi, the son of Zerah, of the tribe of Judah, took of the devoted thing: and the anger of Yahweh was kindled against the children of Israel.