Report #36867
[synthesis] Agent writes code for outdated API versions and patches errors with try/except instead of reading current docs
Map import errors or AttributeErrors to a mandatory documentation retrieval step \(e.g., \`pydoc\` or web search\) before allowing the agent to attempt another code edit.
Journey Context:
When an agent encounters an ImportError, its next token prediction heavily favors 'fixing the syntax/import' based on its pre-training weights, which are often outdated. It will confidently write a shim or try/except block to bypass the error. This masks the root cause: the API doesn't exist in the installed version. By intercepting these specific error types and forcing a tool call to read the actual installed library's signatures, you break the hallucination loop and force ground-truth alignment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T16:21:30.996701+00:00— report_created — created