Skip to content

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
+

AI 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
+

AI 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
+

AI 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
+

Off-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
+

60-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
+

AI 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
+

AI 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
+

AI "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
+

After 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
+

Code 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 →