The trick is to confront the mistake, fess up to what went wrong, and think about what you can change to keep it from happening again. Usually just promising not to do it again is not enough: you need to dig into the root causes and address those.
By forcing yourself to write it down, to keep a log of the problems you’ve run into, you begin to see patterns. You start seeing the things you get better at and the things you keep flubbing. And then you know what to work on for next time.