Report #31329
[research] Generating Python/JS code that imports non-existent packages or calls fabricated API methods
Cross-reference generated imports against a verified package index \(e.g., PyPI, npm\) or restrict generation to a predefined list of allowed libraries before executing or presenting the code.
Journey Context:
LLMs learn the syntax of package imports but not the exact namespace of every library version. They confidently invent packages \(e.g., 'import python-abc' instead of 'from abc import ABC'\) or invent parameters for standard libraries. Static analysis or execution in a sandbox is required to catch these, as the model's internal confidence is indistinguishable from correct code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:58:23.495610+00:00— report_created — created