> Indeed, working hard towards a goal is never a waste, it can often be a learning experience regardless of the end result.
What if the end result is harmful to society?
I guess that would depend on your own personal moral backbone as to which direction you would go at that point. Undoubtedly you’ll learn something either way, but hopefully someone would adjust for their next effort.
Then you learn, adjust and try to avoid that in the future, ideally helping others from making the same mistake. Everyone makes mistakes, the scope/extent is slightly different for all of us, but everyone should have chance at redeeming themselves even if they did harm. Otherwise we'll run out of compassion very quickly.