So, if we had a separate (hypothetically) env_validate() function, then we could just thoroughly test that vs weird cases (e.g., via fuzzing), and we could call that early-on in main(). Then, most other functions could assume a reasonable environment, and we could simplify a few things (and hopefully make error handling simpler).
Sounds like, at least, a reasonable consideration…