Report #53500
[research] Agent hallucinates non-existent package or library names in code
Implement a validation step that checks imported packages against a live registry \(PyPI, npm\) or a curated allowlist before executing or presenting code. Never trust the LLM's internal knowledge for package namespaces.
Journey Context:
LLMs generate statistically plausible names \(e.g., huggingface-cli instead of transformers\) that often don't exist or are malicious typosquats. Agents often blindly execute pip install on these, leading to failures or security risks. Relying on the model's parametric memory for namespace resolution is fundamentally flawed because it optimizes for fluency, not existence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:17:47.146718+00:00— report_created — created