Report #13993
[research] Inventing non-existent methods on standard objects \(e.g., \`str.reverse\(\)\` in Python\) that look idiomatic but throw AttributeError
For standard library interactions, constrain generation using a static analysis linter \(like pyright/mypy\) in the agent loop, or strictly enforce AST validation before presenting the code to the user.
Journey Context:
LLMs learn syntactic patterns but often fail at exact API boundaries, inventing methods that \*should\* exist based on object-oriented intuition but don't. Because standard libraries are closed sets, static type checking is highly effective at catching these hallucinations before runtime, unlike dynamic external packages.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:20:18.973870+00:00— report_created — created