We should emulate Hashem in our deeds.
“And the L-rd said to Joshua: Get yourself up; why do you fall upon your face? Israel has sinned” (Joshua 7:10–11). Joshua said before Him: Master of the Universe, who sinned? God said to him: And am I your informer? Rather, cast lots to determine who is guilty. In this way, God did not directly disclose the identity of the sinner to Joshua. And if you wish, say instead that Shecaniah ben Jehiel learned this from an incident involving Moses, as it is written: “And the Lord said to Moses: How long do you refuse to keep My mitzvot and My laws?” (Exodus 16:28). Although only a small number of people attempted to collect the manna on Shabbat, God spoke as though the entire nation were guilty, so as not to directly expose the guilty.