What is Package Hallucination?
How package hallucination works
An AI model suggests packages by predicting plausible names from the code it learned on. When it isn't sure, it can produce a name that sounds real but was never published, like a tidy, sensible-looking library that simply doesn't exist. Normally installing it just fails. The danger comes when attackers notice the same invented names appearing again and again in AI output, then publish actual harmful packages under those exact names. This attack has a nickname, "slopsquatting," and it turns a harmless-looking install command into a way to run someone else's code inside your project.
Package hallucination example
Say an AI tells you to install a package to handle image uploads, with a clean, believable name. You run the install and it works, so you trust it, but the real library never existed under that name; someone registered it after spotting the AI recommending it. Now their code is running in your app. The safe habit is to verify any unfamiliar package on its official registry and confirm its genuine before installing.
Frequently Asked Questions
Your Questions, Answered
Don't change this element unless you know what you are doing
on Emergent today


