Hallucinated APIs and packages
For engineers
Catching invented functions, made-up package names and outdated APIs in AI code before they are installed or shipped
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
An AI-written diff calls db.users.findByEmail(). What is the most reliable first check?
Check yourself · 2 of 5
What makes a hallucinated package name a security problem and not only a bug?
Check yourself · 3 of 5
Where do you find the library version your project actually runs?
Check yourself · 4 of 5
Why can an install command be more dangerous than a normal code edit?
Check yourself · 5 of 5
Which check best catches an invented method on a typed library?
Topics
- Catching invented functions and parameters4 min read · Methods, flags and config keys that look plausible but do not exist in the library, and how to check them quickly against types and docs
- Slopsquatting and invented package names5 min read · Attackers register the package names models invent, turning a hallucination into a supply-chain attack on npm and PyPI
- Version drift and deprecated library calls4 min read · Models trained on older docs write removed or deprecated calls; matching the code to the version pinned in the lockfile
- Agents installing packages on their own5 min read · Install commands in agent transcripts, postinstall scripts and package-manager permission rules that let unvetted code run
- Defences against phantom dependencies5 min read · Lockfile review, allow-lists, registry proxies, install-time checks and current docs in the agent's context
Start here
- We Have a Package for You! Package hallucinations by code-generating LLMs (opens in a new tab)PaperFree
The study that measured how often code models invent package names, across languages and models.
- Slopsquatting: how AI hallucinations are fueling a new class of supply chain attacks (Socket) (opens in a new tab)ArticleFree
Explains the attack in plain terms and what defenders can do about it.
- Concise Guide for Evaluating Open Source Software (OpenSSF) (opens in a new tab)ArticleFree
A short checklist for judging whether a package is maintained, trusted and the one you meant.
Scenarios
Helps to know first
110 questions · last verified 2026-12