He already knows about the errors (original sin), pre-planned for it, and has coded the resolution (man chooses God over sin; God saves man).
Just remember, God is not linear. He has no beginning, and no end. He exists outside our time dimension. Only he can fix the program.
SFS