Report #26792
[counterintuitive] Model generates code with non-existent API methods or parameters
Always verify generated API calls against actual documentation or by running the code. When working with unfamiliar or recently-updated libraries, retrieve actual API docs rather than relying on parametric knowledge. Use type checking and linting to catch phantom APIs.
Journey Context:
Models generate code by predicting the most plausible next token, not by looking up documentation. When a model generates requests.get\(timeout=30\), it predicts that this is a likely API based on training data patterns, not by verifying that timeout is a valid keyword argument for requests.get. For well-known, stable APIs this works well. For less-common or recently-changed APIs, the model confidently generates plausible-but-fake methods. This is fundamental: the model's knowledge is a lossy compression of training data, not a lookup table. The model cannot distinguish between 'I know this API exists' and 'this API seems like it should exist.' The fix is always external verification: run the code, check the docs, use a type checker. For coding agents, this means building a verify-then-trust workflow rather than trust-then-verify.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:22:13.817012+00:00— report_created — created