How many times are you willing to fail? 3 times? 80 times? 1,295 times? Is there even a number?
Regardless of metrics, failure is valuable. It teaches us what we really do want, and what we don’t want. Failures forces you to learn or lose. Failure is also a good compass. Showing you how much closer you are to your goal.
Maybe you should learn how you can be okay with failure until things pan out. At least failure shows that you making an attempt to fix something.