Hallucinated Package

ErrorIntermediateSeverity: HighSecurity

Installation fails with a message that the package does not exist, or an import of a library that does not exist.

Symptoms

  • Installation fails with a message that the package does not exist, or an import of a library that does not exist.
  • A package whose name is close to a well-known library you have never heard of.

Cause

Models can invent plausible-looking package names. Worse, someone may have registered a malicious package under that same name, which is sometimes called "slopsquatting".

Fix

  • Do not install any package before checking it in its official registry (PyPI or npm): the developer, the download count, the release date and the repository.
  • Ask the agent to use a well-known alternative library or the standard library.

Prevention

  • Write in the context file: "Do not add any new dependency without asking me."
  • Review the dependency files in every diff.