At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.

If you never learn from your mistakes, you’re doomed to repeat them. Suffering the same problems over and over is a miserable situation. The first time you go through a failure is fine; it’s a learning experience. After that, you’re not learning anymore. You’re just plodding through a suboptimal existence.
This is where reflection comes in. The team needs to stop from time to time and examine their recent problems. They also should consider their processes and procedures. Are there changes the team could make which would lead to a more productive outcome? Can improvements be put into place so that certain failures no longer occur?
Sometimes it helps to have reminders of agreed-to improvements posted in a highly visible place. It would be quite unfortunate to have people revert to the behavior that causes problems. Learning often requires reinforcement of ideas, especially if a message can be delivered in multiple methods. State it vocally, agree to it in writing, post the message on a poster, add it to a code review checklist, and find other ways to drive the message home.
We all learn from experience. How well we respond to failures depends on our capacity and desire to improve ourselves, our teams, and our systems.