Another interpretation: All of you are sureties for one another. Even if there is but one righteous person among you, all of you stand by his merit; and not you alone, but the whole world in its entirety, as it is said, "But a righteous one is the foundation of the world" (Proverbs 10:25). And when one person sins, the whole generation is smitten. And so you find with Achan, "Did not Achan son of Zerah commit a trespass in the devoted thing, and wrath fell upon all the [congregation of] Israel? And he was but one man, yet he did not perish alone in his iniquity" (Joshua 22:20). If the measure of punishment, which is small, caused the generation to be seized, then the measure of goodness, which is abundant, how much more so. Therefore it is said "every man of Israel" (Deuteronomy 29:9) — and not the great ones among you alone, but "your little ones, your wives, and your stranger" (Deuteronomy 29:10). Therefore it is said "every man," for flesh and blood shows more mercy to the males than to the females, but the Holy One, blessed be He, is not so; rather, "His mercy is upon all His works" (Psalms 145:9) — upon the males and upon the females, upon the righteous and upon the wicked, as it is said, "from the hewer of your wood unto the drawer of your water" (Deuteronomy 29:10). Rabbi Yitzhak ben Tavli said: This teaches that the Gibeonites came to [Moses and he did not accept them, and they came to] Joshua and he accepted them, as it is said, "they also acted with cunning" (Joshua 9:4). What is "they also"? It teaches that they had come to Moses and he did not accept them.
Achan's Sin and How One Righteous Person Sustains the World
Midrash Tanchuma Buber, Nitzavim 5:2
ד"א כולכם ערבים זה בזה, אפי' צדיק אחד ביניכם, כולכם עומדין בזכותו, ולא אתם בלבד, אלא כל העולם כולו, שנאמר וצדיק יסוד עולם (משלי י כה), וכשאחד חוטא כל הדור לוקה, וכן אתה מוצא בעכן, הלא עכן בן זרח מעל [מעל] בחרם ועל כל [עדת] ישראל היה קצף והוא איש אחד ולא גוע בעונו (יהושע כב כ), מדת פורענות מועטת, והדור נתפש, מדה טובה מרובה, על אחת כמה וכמה, לכך נאמרכל איש ישראל, ולא גדולים שבכם בלבד, אלא טפכם נשיכם וגרך (דברים כט י), לכך נאמר כל איש, שבשר ודם מרחם על הזכרים יותר מן הנקבות, אבל הקב"ה אינו כן, אלא ורחמיו על כל מעשיו (תהלים קמה ט), על הזכרים ועל הנקבות, על הצדיקים ועל הרשעים, שנאמר מחוטב עציך עד שואב מימיך (דברים כט י), אמר ר' יצחק בן טבלי מלמד שבאו הגבעונים אצל [משה ולא קיבלן, ובאו אצל] יהושע וקיבלן, שנאמר (ועשו) [ויעשו] גם המה בערמה (יהושע ט ד), מהו גם המה, מלמד שבאו אצל משה ולא קיבלן.