AI calls methods and fields that don't exist
A practical fix and a copyable AI coding prompt. Replace bracketed placeholders with your project details.
1. Check the problem
The model references methods or fields that don't exist in your version, silent until that path runs. Turn on a type checker (`tsc --noEmit`, mypy) to fail at build time, and feed it real docs via Context7 MCP.
2. Use the prompt
I'm on [library] version [X]. Before I trust this code, verify that every method, field, and option it uses actually exists in that version, not a hallucinated or renamed API. If you're not confident your training is current, say so and ask me to paste the docs. Then run the type checker and fix anything that doesn't resolve.3. Verify the fix
Review the proposed diff, run the relevant checks and exercise the original failing flow before merging.
Continue in the related workflow chapter or read the longer explanation.