I like to refer to this as "the hardest problem in computer science."
Several times over my ten-year career I've spent months building a thing to what we thought were the specs, only to have to throw most of it away because the specs change at the last minute, or somebody learned the hard way that details like are you paying for access to the thing, or access to the group the thing is in can actually matter a whole lot when you're building software. I would say I nearly always spend more time defining the problem than solving it.