Report #6464
[research] LLM generates code using plausible but non-existent library methods or API endpoints
Require the agent to read the actual documentation or source code of the library before generating the implementation, or restrict output to only standard/well-known APIs.
Journey Context:
LLMs excel at mimicking syntax and naming conventions, leading them to invent methods that perfectly fit the user's request but don't exist in the actual codebase \(e.g., pandas.fast\_merge\(\)\). This is extremely dangerous in automated pipelines because the code looks correct and passes superficial review. Grounding the code generation in actual, retrieved API specs or docstrings is the only reliable defense against API hallucination.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:11:21.994242+00:00— report_created — created