AI Coding Tools Frequently Recommend Nonexistent Packages, Opening Door to Attacks
A study presented at USENIX Security 2025 found that nearly one in five code samples generated by AI models imported packages that do not exist on PyPI or npm. Researchers tested 16 models across 2.23 million samples, with open-weight models hallucinating far more often than commercial ones. A later 2026 re-test of five frontier models still found hallucination rates between 4.62% and 6.10%, with 127 invented names recurring across all five. To show the risk, a research team registered 107 hallucinated names on npm for about $496, and over six months real developers installed them. The issue is compounded by agentic tools that install dependencies automatically, often without a human noticing the fabricated name.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in