It is management failure, not engineering failure!
Any project no matter how big or small needs to start with an end in mind. Even if it's an open-ended task or you are building a prototype where everything is an unknown. It's not difficult to draw lines in the sand before you even start.