Skip to content
>devspeak
← glossary
level 8Advanced AI-Assisted Development

Hallucination

also: hallucinations, hallucinated, hallucinating, hallucinate

When an AI confidently says something that isn't true, like inventing a function that doesn't exist or claiming tests passed when it never ran them.

a bit more technical

Output from a language model that is fluent and confident but false or unsupported, such as nonexistent functions, package names, file paths, or settings, or false claims about actions it took. It happens because models generate plausible text rather than looking facts up.

picture it

A very confident tour guide who, when he doesn't know an answer, makes up a convincing one instead of saying "I don't know." It sounds exactly like his real facts.

why it matters

Agents sound equally sure when they're right and when they're wrong. The fix is evidence: ask to see test output, error messages, documentation, or the actual file, rather than trusting a summary.

what your agent might say
agent
I may have hallucinated that option. I don't see retryOnFailure in the library's type definitions. Let me check the docs and use a supported setting instead.
how you might use it
you → your agent
Before using any library function, confirm it exists in the installed version's docs or type definitions. When you say tests pass, paste the actual test output.
common mistake

Thinking hallucinations are rare or obvious. They're often small and believable: a plausible function name, a settings flag, or "all tests pass" without running them.

builds on