Programmers are rarely genuine experts in the domain, we depend on the subject matter experts to define the parameters for the system under construction. Some SMEs have deep knowledge and would know these, but many, while very knowledgeable, have not encountered the specific edge cases nor heard about them. As a result, the design incorporates these inaccurate assumptions, and for a long time it works fine. Until it doesn't. And by the way this is why waterfall and big design up front fails as a development methodology.
tl;dr: you can't know absolutely everything ahead of time.
tl;dr: you can't know absolutely everything ahead of time.