Definition
Package hallucination is the failure mode where an LLM suggests importing a package that does not exist in the relevant registry. Attackers can then register the hallucinated name with a malicious payload, waiting for the next developer to take the suggestion.
In Depth
Lasso Security's 2025 research found that about 19.7% of LLM-generated coding suggestions reference packages that do not exist. Because hallucinations cluster around plausible names (ultra-fast-json-parser, react-animation-pro), attackers squat on those names in npm, PyPI, and cargo. Production startups were compromised in 2025 and 2026 by installing hallucinated packages. The mitigation is pre-install verification using Google SERP and Reddit signal to confirm a package has a real footprint before running npm install.
Example Usage
The CI pipeline added a Scavio-powered verifier that blocked a hallucinated npm package before install ran.
Platforms
Package Hallucination is relevant across the following platforms, all accessible through Scavio's unified API:
Related Terms
Retry Storm
A retry storm is a failure mode in which many agents retry a soft-failing request simultaneously, cascading into rate-li...
Agent Harness
An agent harness is the runtime and orchestration layer around an LLM that decides when to call tools, how to manage mem...
Tool Gateway
A tool gateway is a shared service that sits in front of an agent's external tools to centralize authentication, rate li...