AI coding assistants fail at dependencies in two directions at once, and the obvious one is not the dangerous one. Unused imports get flagged by every linter on every commit. Quiet reliance on something nobody declared, a package already sitting on a dev machine, a system binary on the PATH, an old environment variable, stays invisible until the environment changes and the code simply stops working.
The Details:
- Models generate code by pattern matching against a massive corpus where common tools were simply present, not because anyone declared them but because something else installed them first. The model writes for an imagined environment instead of reasoning about the one you actually have, so it cannot tell intentional dependencies from accidental ones.
- Linters only see what is written in the file: the import line, the function call, the unused variable. They have no visibility into a subprocess shelling out to a command line tool, or a system library the base image never included, so a clean lint pass says nothing about whether the code will survive a fresh container.
- Dependency scanners trust whatever manifest they are given. A plain requirements file lists only what someone typed, not the full chain beneath it, so a clean security scan on an incomplete manifest creates false confidence rather than removing risk.
- Building every feature branch in a fresh container before merge forces hidden dependencies to surface while the engineer who wrote the code still remembers the reasoning, rather than months later when a swapped package or a new teammate's laptop exposes the gap.
Bottom Line: A codebase that runs on your machine is not proof that it declares what it needs; only a clean build from a fresh environment tells you the truth.