Know Your Enemy
The 10 Failure Modes of AI Coding
You can't prevent what you don't understand. These are the ways AI coding actually fails — documented with evidence, not anecdotes.
01 Hallucination
CRITICAL +
Hallucination
CRITICALAI invents APIs, methods, or libraries that don't exist. Produces confident, plausible-looking code built on fabrications.
PREVENTION:
Demand evidence: file paths, line numbers, documentation links. "Show me where this API is defined."
02 Context Drift
HIGH +
Context Drift
HIGHAI gradually forgets constraints established early in conversation. The 39% performance drop in multi-turn conversations.
PREVENTION:
CLAUDE.md files, session boundaries, CRITICAL LOW CONTEXT protocol.
03 Confident Wrongness
CRITICAL +
Confident Wrongness
CRITICALAI presents incorrect solutions with high confidence. Stanford: developers WITH AI wrote less secure code while feeling MORE confident.
PREVENTION:
"Are you 100% sure? Check again systematically." Force re-verification.
04 Subtle Logic Errors
HIGH +
Subtle Logic Errors
HIGHOff-by-one errors, race conditions, edge cases. AI code looks correct at a glance but fails under specific conditions.
PREVENTION:
Test verification layer. "What edge cases exist? Handle each one explicitly."
05 Security Blindness
CRITICAL +
Security Blindness
CRITICAL60-70% of AI vulnerabilities are BLOCKER severity (Sonar). AI doesn't think adversarially — it generates functional code, not secure code.
PREVENTION:
Explicit security review layer. "What are the OWASP Top 10 risks in this code?"
06 Dependency Hallucination
MEDIUM +
Dependency Hallucination
MEDIUMAI suggests packages that don't exist, are deprecated, or have known vulnerabilities.
PREVENTION:
Verify every dependency exists and is maintained before installing.
07 Pattern Mismatch
MEDIUM +
Pattern Mismatch
MEDIUMAI uses patterns from other frameworks/languages that don't fit your project. React patterns in Vue, Python idioms in JavaScript.
PREVENTION:
Contextual verification: "Does this match the patterns used in THIS project?"
08 Scope Creep
MEDIUM +
Scope Creep
MEDIUMAI "helpfully" modifies files or adds features you didn't ask for. The Replit incident: AI modified production during a code freeze.
PREVENTION:
Explicit scope in every prompt. Review all changed files, not just the target.
09 The Sunk Cost Spiral
HIGH +
The Sunk Cost Spiral
HIGHAfter 2+ failed corrections, you're "in too deep" to restart. Each correction introduces new bugs. The 693-line hallucination spiral.
PREVENTION:
2 corrections max rule. After 2 failures: stop, restart with better prompt.
10 Comprehension Debt
HIGH +
Comprehension Debt
HIGHCode works but you don't understand it. You can't debug, extend, or explain it. 17% lower comprehension with AI (Anthropic, 2026).
PREVENTION:
"Can I explain every line?" If not, don't ship it.
How many of these are you currently preventing?
Find out →