And it repented the LORD that he had made man on the earth, and it grieved him at his heart. And the LORD said, I will destroy man whom I have created from the face of the earth; both man, and beast, and the creeping thing, and the fowls of the air; for it repenteth me that I have made them. [Gen 6:6-7]
And how do you know that this passage is evidence of God making a mistake?
Does man not have free will to commit acts that are then punishable?