What is a 'mistake'? You are at point A. You want to go to point B. You think action X will take you to point B - so you do action X. But after doing action X, you end up at point C. Then you analyse the whole process (of you doing action X and going from point A to point C). Based on your analysis, you now think that you should have done another action Y to go to point B. Then you say that action X was a 'mistake'.
When you were at point A, you had a certain amount of information. Based on that information, you decided that action X would take you to point B. Now - after doing action X and going from point A to point C, your information has increased. So now based on this increased information, you are saying that you should have done action Y instead of action X. Did you have this information when you were at point A? No.
You will say: "I should have collected more information when I was at point A". The truth is you collected as much information as you could when you were at point A. There is a limit to how much knowledge we can acquire through mere data-collection - and you had reached that limit at point A. The only way to acquire more knowledge is through experience - ie, doing action X and going from point A to point C.
Another way of understanding this is to ask the question: "In what scenarios will we never make a 'mistake'?". Answer:
1. When we have complete information/knowledge - This is impossible because we are humans, not Gods.
2. When we don't try to go from point A to point B at all - ie, When we don't try anything at all.
Seen this way, we realise that mistakes are the only way for us to reach our goals. That is - mistakes are necessary.