The LORD then said to Joshua, “Stand up! Why are you on the ground? Israel has sinned. They have violated My covenant that I appointed for them. They have taken some of what was set apart. They have stolen, deceived, and put the things with their own belongings.” – Joshua 7:10-11

After the unexpected defeat at Ai, Joshua was both fearful and crestfallen. He was fearful because he wondered if God had abandoned Israel and he was crestfallen because if God HAD abandoned them, they were without hope. As he threw himself before the Lord, he even implied that perhaps God was at fault (7:7). How did God respond to Joshua’s pleas? His reply was direct, factual, and brutally honest.
While I would never suggest that failures and difficulties are always a result of sinful actions, we must be willing to entertain that possibility. Before we ask God, “What are You doing?,” we should ask, “What have I done?” And when the fault is ours, there is no need to complicate our response. Just stand up (face the fact of our failure) … admit the fault (confess it) … quit it … and move on in greater obedience for His greater glory.
God has promised forgiveness to your repentance, but He has not promised tomorrow to your procrastination. – Augustine