All project failures can be prevented.
There are countless reasons. Some technical and some non-technical. Some internal and some external. Some we can control and some we cannot.
But there is one thing that they all have in common: we can raise the red flag. With enough experience, we can see things coming before it’s too late. Is the deadline too ambitious? Are specifications still not ready after a month? Did someone expect you to do something but didn’t explicitly ask you? Was someone supposed to have validated your work weeks ago? Is your source control workflow causing conflicts on each merge? Do bugs reappear after being fixed? Did you spend much more time than expected on a feature? Does a coworker promise things yet doesn’t deliver? The list goes on.
You can feel when trouble is coming. You know you can. If you wait until trouble happens to confirm your suspicions, it’s already too late. As soon as you know something, tell the people in charge. Raise that flag. Nobody knows the terrain as well as you do. Yes, many times people ignore these flags because of overconfidence or just lack of interest in the project. It’s not your fault. But at least you raised that flag. It can make all the difference between project success and project failure. If anything, you’ll sleep better at night knowing that you have done your duty and tried to help.