People, however, only learn by making mistakes.
This creates a bit of a problem. In a truly efficient system, there would be no opportunity for people to learn. When there is no learning, the system will eventually fail: either it becomes rigid or it stagnates, but in either case it fails to adapt to changing conditions in the environment.
Shoto Funakoshi, the founder of Shotokan Katate, used to say that in the practice of Shotokan there was no room for error. American students never had the patience for the level of perfection demanded in more traditional Japanese dojos; instead, they made a great many mistakes. Today, Americans win most of the competitions.
Fencing is a very precise sport: a master swordsman can hit a moving quarter with the point of an epee. Yet, the winner of the competition is frequently not the person with the most perfect moves. Instead, the winner is often the person who appears to be making mistakes.
Now, there are certainly situations in which there is no room for mistakes: surgery and landing an airplane are two that come to mind. However, for someone to become a master surgeon or a successful pilot they had to make a lot of mistakes along the way. The goal, of course, is make sure those mistakes occur in settings that do not involve people getting killed. And, although both of them are required to perform potentially difficult operations without error, they are also expected to rapidly recognize and adjust to changing circumstances, for example having both engines of your airplane taken out of action by birds. That ability to adjust can only come from experience in dealing with unexpected or unusual situations: in other words, coping with mistakes without losing your mental balance.