Report #24517
[counterintuitive] AI generates syntactically valid API calls that violate semantic contracts
Treat every AI-generated API call as unverified until checked against canonical documentation. Integrate a validation step: run type checkers \(mypy, TypeScript strict\), linters, and where possible, compile-time contract checks before executing AI output. For critical paths, cross-reference generated calls against the actual source or official docs, not the model's suggestion.
Journey Context:
AI learns statistical patterns of API usage, not the actual preconditions, postconditions, and invariants. It will generate calls that look like real usage—correct module, correct function name, plausible arguments—but violate ordering requirements, ignore required state, or misuse optional parameters in ways that compile and even run but produce silent wrong results. This is worse than a syntax error because it passes superficial checks. The model's confidence is highest for popular APIs \(where training data is dense\), which is exactly where subtle contract violations cause the hardest-to-debug failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:33:36.107506+00:00— report_created — created