Report #15823
[research] LLM hallucinating non-existent library functions, classes, or API endpoints
Require the agent to read official documentation or source code to verify the existence of an API before using it. If docs are unavailable, wrap the call in a try-except or explicitly mark it as unverified pseudo-code.
Journey Context:
Code LLMs predict syntactically valid but semantically invalid code by blending patterns from similar libraries. This causes runtime errors. Grounding in actual library signatures \(e.g., via tool use or repository context\) is the only reliable fix, as the model's prior strongly favors popular but inaccurate API patterns.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:12:25.018871+00:00— report_created — created