Report #12108
[research] Generating code that imports non-existent packages or calls non-existent API methods
Ground code generation against a known dependency manifest \(e.g., package.json, requirements.txt\). Run static analysis or automated tests post-generation to catch hallucinated methods before presenting them to the user.
Journey Context:
LLMs trained on GitHub encounter deprecated, private, or fictional code. They will invent highly plausible-looking APIs \(e.g., a non-existent method on a standard library class\) because they model the syntax of code well but lack a live type-checker. Post-generation execution or linting is the only reliable defense against syntactically correct but semantically invalid code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:09:36.332909+00:00— report_created — created