The 13 ways an autonomous coding agent fails.
With examples. No jargon. Tagged on every MartinLoop run record so you can see exactly what went wrong.
Published May 14, 2026 · Updated May 31, 2026 · 7 min read
When we started building MartinLoop, we kept seeing the same problem: autonomous coding agents fail in specific ways, but the logs all looked the same. “Run completed in 47 attempts. Final state: failed.” That tells you nothing.
So we sat down and wrote out every distinct way we’d watched an agent fall over. We landed on thirteen. Every MartinLoop run record tags the failure by class, so when you replay it, you don’t have to guess. The full union is in the open-source contracts package — FailureClass in @martin/contracts.
The thirteen
1. Logic error
Code runs, does the wrong thing.
Example: Off-by-one. Wrong sort order. Comparing strings to numbers.
2. Hallucination
Invents an API or library that does not exist.
Example: Calls Stripe.charges.refund_v2(). There is no v2.
3. Syntax error
The patch literally will not parse.
Example: Missing brace. Trailing comma in the wrong language.
4. Type error
Breaks the type system.
Example: Returns a Promise where the callsite wants a number.
5. Test regression
Fixes one test, breaks another.
Example: Auth fix triggers a cascading failure in three other suites.
6. Scope creep
Touches files it was not asked to.
Example: Asked to fix login. Rewrites the design system.
7. No progress
Same edit, same failure, on repeat. Classic Ralph.
Example: Reverts and re-applies the same diff for 12 attempts.
8. Repo grounding failure
Does not actually understand the codebase.
Example: Imports from a path that does not exist in this repo.
9. Verification failure
The verify command says no.
Example: pnpm test exits 1. The agent wanted to call it done.
10. Environment mismatch
Works on the agent machine, breaks on yours or in CI.
Example: Hardcoded /tmp paths. Missing env var in CI.
11. Budget pressure
Run is approaching the cap; next attempt would breach it.
Example: At $2.85 of $3.00. The next API call is rejected before it goes out.
12. Safety leash blocked
Policy-as-code refused the action before it ran.
Example: Agent tried to edit a file outside the allowed scope, or write a secret-like value. Run halted, escalated for human approval.
13. Sandbox write blocked
The fix exists, but it could not be written to disk.
Example: The run produced a valid patch and the sandbox refused the write inside the allowed workspace.
Why this matters
Every one of these gets a different fix. A hallucination needs a grounding check. A no-progress loop needs a hard stop. A budget-pressure exit needs a higher cap or a smaller task. If your runtime tags failures the same way, your post-mortems become mechanical instead of investigative.
That’s the whole pitch: the runtime controls that map to each failure class — and the full guide to agent loops for context.