Job 40:2 (ESV)

2 “Shall a faultfinder contend with the Almighty? He who argues with God, let him answer it.”

Job had indeed sinned with his words. He was not wrong to defend his innocence. His sin had been to question God’s counsel and to accuse God of injustice. He had thought to approach God like a prince (Job 31:37), not considering God’s infinitely superior power, wisdom, and goodness.