How often do AI code edits fail? Ours failed 5.8% of the time
- On 2026-07-28 we counted every edit our agent made across 129 preserved traces: 434 str_replace calls, 25 failures — a 94.2% apply rate.
- Nearly all are anchor problems: 11 quoted text appearing more than once in the file, 11 quoted text not in the file as written, 3 bad arguments or a missing file.
- The rate is that high because the loop forgives whitespace, nudges the agent to re-read when an anchor misses, and tells it to quote the line above and below its target.
- This is our agent on our own traces. It is not a measurement of any other coding tool.
Ask how often an AI coding agent's edits fail and you get a shrug, a vibe, or a figure someone half-remembers from a thread. That is odd, because it is trivially countable: the edit either landed or the tool refused it, and the refusal is written down in the trace with its reason attached. So we counted ours. On 2026-07-28, across 129 preserved traces, our agent issued 434 str_replace edits and 25 came back as errors.
What the number measures
A str_replace edit is the surgical option: instead of rewriting a file, the agent quotes the exact text it wants replaced along with its replacement, and the tool swaps them. If that anchor cannot be found, or turns up in more than one place, the tool refuses, writing nothing and returning an error saying which. That refusal is the failure we counted, so it costs a retry rather than a corrupted file.
Two things it is not. Not correctness: an edit can apply cleanly and still be the wrong change. And not a benchmark of the field — one agent, one harness, one set of traces.
The 25 failures, by cause
Sorted by the error returned, the whole tail fits in three rows:
| Cause | Count | What it means |
|---|---|---|
| “Found N matches for old_str” | 11 | The anchor was real but not unique — a repeated import, a boilerplate line, a block appearing twice. The tool refuses rather than pick one. |
| “No match for old_str (even ignoring whitespace)” | 11 | The anchor did not exist as written — the agent quoting from memory, or from a version an earlier edit had changed. |
| Bad arguments or file not found | 3 | A malformed call, or a path that was not there. The smallest slice. |
| Total | 25 | 5.8% of 434 calls |
The split is the useful part. The anchor causes are dead even at 11 apiece — all but three of the 25 between them — and both are failures of quoting rather than of reasoning: the agent knew the change it wanted and described the target badly, once too vaguely to be unique and once simply wrongly. Almost nothing here is the model misunderstanding the task, which is what people picture when they imagine an edit failing.
Why the rate is as high as it is
This is the part worth taking away, because none of it is exotic. Three cheap mechanisms sit in the loop already, each aimed at a cause in that table.
- A whitespace-tolerant match. If the anchor differs from the file only in indentation or trailing spaces, the edit still applies, removing a whole category of near-miss. The surviving error reads “even ignoring whitespace” — the tolerance announcing it was already tried.
- A re-read nudge when an anchor misses. A failed match comes back with a prompt to go and look at the file again, turning the commonest self-inflicted failure into one wasted turn rather than a loop.
- Explicit guidance to disambiguate. The agent is told to include the line above and below its target. A three-line anchor is far likelier to be unique than a one-line one — the direct remedy for the “found N matches” row.
None of that needed a bigger model or a second agent. It is error-message design and prompt guidance, applied to the path an edit takes when it goes wrong.
The decision this number drove
Here is the part that makes measuring worth the effort, and it is not a boast. Our 2026-07-28 technique scan put Microsoft's SWE-Edit top of the shortlist. Microsoft's report describes lifting edit success on open reasoning models from a 75.6–82.0% band to 93.9–95.9%, using a viewer/editor subagent split plus a whole-file-rewrite fallback. A large, well-evidenced gain — and we did not adopt it.
| Measurement | Edit success | Verdict |
|---|---|---|
| Our agent — 129 traces, 434 calls, 2026-07-28 | 94.2% | Our measured baseline |
| Open reasoning models before SWE-Edit (Microsoft's report) | 75.6–82.0% | A floor we are not standing on |
| The same models after SWE-Edit (Microsoft's report) | 93.9–95.9% | A band we are already inside |
| SWE-Edit, adoption decision | — | Dropped — no headroom for us |
Read the rows together and the logic is plain. SWE-Edit's gain is almost entirely the distance from the low band to the high one, and we start inside the high one. Its benefit comes from lifting models off a floor we are not standing on, while the costs stay real: more model calls per edit, and a fallback that rewrites a file wholesale where three lines would have done.
None of that was knowable without the baseline. With no number the shortlist item reads as a straightforward upgrade, you adopt it, and you pay for a gain you cannot collect. The most useful result of measuring your own system is finding out which improvements cannot help you.
How to decide
Weighing a technique like this, three questions do most of the work:
- What is your own number? Count the tool refusals in your traces before reading anyone's benchmark. A headline gain means nothing until you know which end of its range you stand on.
- Does the gain come from lifting a floor you are on? Most improvements are measured on systems failing in one specific way. If yours does not fail that way, the gain is not transferable, however sound the study.
- What does it cost if it lands neutral? Price the extra model calls, the added latency and the new failure modes, then assume the benefit is zero. If your own count sits in Microsoft's pre-fix band rather than near ours, start with the three cheap fixes above instead.
Frequently asked questions
What counts as a failed edit?
A refusal by the edit tool, recorded in the trace: the agent quotes the text it wants replaced, and if that anchor is missing or appears more than once, the tool writes nothing and returns an error. That is the event we counted, 25 of 434 calls. It measures mechanics, not correctness — an edit can apply perfectly and still be the wrong change.
Is 94.2% a good apply rate?
Good enough that the failures left are cheap. All 25 came back as errors the agent could read and retry against, not as silently corrupted files, and both dominant causes are fixed by re-reading the file and quoting a longer anchor. It is specific to our agent and our traces, so it does not carry across to another harness.
Why did you not adopt SWE-Edit?
Because our own number made its gain unavailable to us. Microsoft's report describes lifting edit success on open reasoning models from a 75.6–82.0% band to 93.9–95.9%, via a viewer/editor subagent split plus a whole-file-rewrite fallback. At 94.2% we were already inside that post-fix band, so the benefit lifts a floor we do not stand on, while the costs would still have been ours to pay.
Try Outlier free
Free Nano + Lite — local, private, no account. Pro is a one-time $249 and adds everything (all 6 model tiers incl. Plus 397B). Founders Lifetime is $249 once. Apple Silicon only.
Download for Mac