Moses believed incorrectly that God controlled everything and that He made a mistake.

God sees the end from the beginning so He doesn`t make mistakes.

Moses did not understand this about God so he concluded that God was surprised by the wickedness and had to change His plan because of it.

God gave man FreeWill because He wanted man to be like Him. The cost of that gift is that many whom He loves and wants relationship with reject Him and choose to be their own god.

The events occurred just as Moses recounted, but his conclusion was based on ignorance of God`s omniscience. This was also evident in how he attributed Pharoah`s stiffneck to God.