The Function Your AI Just Called Doesn't Exist
Published 22 June 2026Your AI writes db.findUserByEmail(email). It reads well. It makes sense. It would work — if that function existed in your codebase. It doesn't. The AI invented it.
Phantom functions are the quietest hallucination
Hallucinated imports crash immediately. Syntax errors get caught by linters. But a phantom function call can sit in your code and look completely legitimate until something tries to execute it.
The AI doesn't make up random strings. It generates function names that follow your project's conventions. If you have a db module, the AI will call methods on it that sound like they should exist — db.findUserByEmail(), db.upsertSession(), db.getActiveConnections(). These are plausible names. They just aren't your names.
Why the model does this
The model has seen millions of database modules during training. It knows the common patterns: find, get, create, update, delete, combined with entity names. When it sees your db import, it generates calls based on what it has seen db objects do in other codebases.
It doesn't read your source files. It doesn't know which methods you've actually exported. It generates what's statistically likely, not what's real.
Common patterns
Every one of these looks right. Every one of these would exist in some codebase, somewhere. Just not yours.
The fix: verify function calls against your real source files
Check scans your project's exported symbols — every function, class, and constant you've actually defined. After the AI writes a file, Check compares the function calls in the generated code against this symbol map. If the AI called something that doesn't exist in your project, it gets flagged.
No AI inside. Check reads your actual source files and builds a real map of your project's exports. Deterministic — same project state, same result, every time.
120 free checks. Install in 30 seconds.
$0.0068 AUD per check after the free tier. No subscription. Credits never expire.
Get startedFrequently asked questions
Why does AI call functions that don't exist?
AI models generate code based on common patterns. If the model has seen db.findUserByEmail() in training data, it will call it in your project — even if your database module doesn't have that method. The model doesn't read your source files at generation time.
How do I catch phantom function calls from AI?
Install Check (npx @golproductions/check --install your_key). After every file write, Check scans your project's exported symbols and compares them against the function calls in the generated code. If the AI called a function that doesn't exist in your project, it gets flagged.
What languages does Check support for function verification?
Check scans JavaScript, TypeScript, JSX, TSX, and all Node.js module formats for exported symbols. It builds a map of your project's real functions and verifies AI-generated code against it.