This problem can show up for short term working goals or even while working towards long term goals. I think it is a well known situation for everyone having those walls in front - barriers, hurdles, hences wherever you look. You put so much effort into a thing that you do not want to believe that it was for nothing. - Even worse is the feeling if you think to be already very close to your final goal. You release your last energy reserves and nothing, nothing helps. You get tired and more frustrated because with every attempt more and more time is wasted.
The reason: Insufficient evaluation, missing knowledge, missing experience and bad luck.
Whenever you set a goal before starting you usually check the possible solutions or ways to reach your goal and choose one that seems to bring an optimum somewhere between quality and required effort and/or resources. This is an evaluation process that is based on a lot of insecurities. While working towards your goal some things may happen that you did not expect and this might affect the required effort or the final output negatively.
Then you maybe already put a lot of effort into your project and to ensure that your work was not for nothing you automatically put more effort into your project. If you face a "real" problem that cannot be solved in an economic way you create a vicious circle.
The solution: Do a pit stop for new evaluation.
When you face a situation that turns out to put your main goal in danger working with the expected amount of effort then take yourself time to
- think of a workaround for your current problem but still should lead you to your goal,
- think of asking for help,
- think if there is additional knowledge that could help you and where you could get it,
- review the estimation of required work to achieve your goal,
- review the goal itself (maybe arriving half the way is enough or another goal is more adequate - at least for now - think of the 80/20 rule here also known as the Pareto principle)
"Giving up" is negatively tagged in our language and "giving up" is seen as a general capitulation. But giving up on something is not a general capitulation.
Giving up is an economical decision driven by experience!
And further:
Giving up NOW does not mean necessarily giving up FOREVER!
Giving up is not necessarily completely STOPPING - it is heading over to new goals.
It might turn out later after the accumulation of additional knowledge and waiting some time that then - later - your goal can be achieved a lot easier.
But after a new evaluation of your current situation it also may turn out to be better to continue because the new situation might add additional value to your project.
Continuing on a difficult thing might empower your personality and your know-how - it might turn you to a leader in your field of work!
Before you decide whether to continue or not make sure that you have well evaluated the situation. When you decide not to continue then think of the experience you got and the opportunity to learn from it - from the situation, from your false estimation but also from all the steps you achieved so far working towards your goal. This reduces the negative feeling of "lost time".