Why your AI agent installs packages that don't exist, and how to stop it
A short breakdown from Adam Rosler, AI engineer. The one you commented GUARD for.
What's happening
AI coding assistants sometimes recommend software packages that don't exist. A model writes one likely piece of text at
a time, so a made-up name can be built from pieces that each look right: "hugging" + "face" + "-" + "cli" sounds exactly
like a real tool. It isn't one: the real package is huggingface_hub, and huggingface-cli is only the name of the
command it installs. Look huggingface-cli up on the Python registry today and you get a 404.
Researchers tested 16 popular code-generating models on 2.23 million package suggestions: almost one in five (19.7%) didn't exist. And the made-up names repeat: when the same question was asked ten times, 43% of the fake names came back every single time.
That's what attackers use. They collect the names models invent and publish real packages under them (this is called
"slopsquatting"). In 2024 a security researcher at Lasso Security uploaded an empty package called huggingface-cli to
see what would happen: it got more than 30,000 downloads in three months.
Why it matters
When a package installs, its own code runs on your machine, with your files and your keys. If your agent installs packages by itself, an attacker who registered the name your agent invented gets to run code on your laptop, and nothing looks wrong: the install succeeds and the name looks right.
What to do
- Check before installing. Does the package exist on its registry? Is it more than 30 days old? A name that doesn't exist, or appeared last week, gets blocked.
- Turn on the setting your package manager already has, set to 30 days:
- pnpm:
minimumReleaseAge: 43200inpnpm-workspace.yaml(it's in minutes; recent pnpm defaults to one day). - uv:
exclude-newer = "30 days"under[tool.uv]inpyproject.toml.
- pnpm:
- Don't trust age alone. After a month, a squatted package passes the age check too. So the last rule is simple: your agent never adds a new package on its own; it asks you, and shows you how old the package is, how many releases it has and where its homepage points.
Sources: Spracklen et al., "We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code
Generating LLMs" (arXiv 2406.10279; USENIX Security 2025); Bar Lanyado, Lasso Security, "AI package hallucinations"
(March 2024); the pnpm and uv documentation. Checked 23 Nov 2026: the Python registry returns "not found" for
huggingface-cli.
Unlock the full GUARD breakdown
Drop your email once to read the complete step-by-step guide, grab the files, and unlock all 96 Reel breakdowns on this device forever.