Troubleshooting

Atlas edit error: Refusing replacement because the matched span is much larger than oldString

Updated 7 min read

Atlas refuses the replacement because isDisproportionateMatch guards the fuzzy replacers: if the matched span is at least max(oldLines + 3, oldLines * 2) lines long, Atlas refuses rather than silently deleting a large block of your code, so the fix is to re-read the file and copy the exact text you want replaced, making oldString cover the whole span you intend to change. The error tells you what to do in its own words: Re-read the file and provide the full exact oldString for the intended replacement. Do not try to work around the guard by shrinking oldString further, because a smaller oldString makes the fuzzy match worse, not better. For multi-hunk changes, use apply_patch instead of one oversized edit.

Why does Atlas refuse a replacement as disproportionate

Atlas refuses because isDisproportionateMatch guards the fuzzy replacers in the edit tool. When the span a fuzzy replacer matched is at least max(oldLines + 3, oldLines * 2) lines long, Atlas refuses the replacement rather than silently deleting a large block of code you never intended to remove.

The guard exists because fuzzy matching, left unchecked, is dangerous. A fuzzy replacer that anchors on a few recognizable lines can stretch its match across a region far bigger than the text you supplied, and applying the replacement would then delete everything in between. The threshold is concrete: a matched span of at least max(oldLines + 3, oldLines * 2) lines trips the guard. So a 2-line oldString that matches a 5-line span is refused, and so is a 10-line oldString that matches a 20-line span. Atlas would rather fail loudly than quietly destroy code, and the refusal message says so.

How to fix a disproportionate match in Atlas edit

Fix a disproportionate match by re-reading the file and making oldString cover the whole span you intend to replace. isDisproportionateMatch refuses any fuzzy match at least max(oldLines + 3, oldLines * 2) lines long, and the remedy the error names is to provide the full exact oldString for the intended replacement.

The mental model that fixes this quickly: the guard is comparing what you asked for against what the fuzzy replacer found, and complaining that they are wildly different sizes. Closing that gap means supplying the real span. Read the file, select every line from the start of the region you want changed to the end of it, and pass that as oldString verbatim. Once oldString and the matched span are the same region, isDisproportionateMatch has nothing to complain about, and the fuzzy replacers are not even needed, because an exact match will be found first.

Why shrinking oldString makes the Atlas disproportionate match worse

Shrinking oldString is the natural instinct and it is exactly backwards. A smaller oldString gives the Atlas fuzzy replacers less to anchor on, which makes the matched span more likely to sprawl, which drives the max(oldLines + 3, oldLines * 2) threshold harder against you rather than away from you.

Developers hitting this error often reason that a shorter oldString is a smaller ask and therefore safer. The arithmetic says otherwise. With oldLines small, the threshold max(oldLines + 3, oldLines * 2) is small too, so even a modestly oversized match trips it. Worse, a tiny oldString is precisely the input that causes fuzzy replacers to latch onto a much larger region in the first place. The direction of travel is the opposite: grow oldString until it is the full, exact span, not a fragment of it. Precision, not brevity, is what gets an edit past this guard.

When to use apply_patch instead of one oversized Atlas edit

For multi-hunk changes, use apply_patch rather than pushing 1 oversized Atlas edit through the fuzzy replacers. A change that spans several separate regions of a file is not a single replacement, and forcing it into one edit is what produces the disproportionate matches isDisproportionateMatch is built to refuse.

The failure mode is recognizable once you have seen it. An agent decides to restructure a file, constructs an oldString from a few landmark lines it remembers, and expects the replacement to sweep everything between them. The fuzzy replacers do match a large span, isDisproportionateMatch measures it, and the edit is refused. The change was never one replacement to begin with. apply_patch handles multi-hunk edits directly, and Atlas computes a unified diff for every file edit and surfaces it for approval before writing, so you still review exactly what lands either way.

How to verify the Atlas edit no longer matches disproportionately

Verify by re-running edit with the full exact oldString copied from the read tool. A proportionate match produces a unified diff for approval, since Atlas computes a unified diff for every file edit and surfaces it for approval before writing. A repeat refusal means the matched span is still at least max(oldLines + 3, oldLines * 2) lines.

Read the diff before approving, and read it with this specific error in mind: count whether the hunk touches the lines you meant and only those. The whole purpose of isDisproportionateMatch is to prevent an edit from quietly removing code beyond your intended span, and the diff is your second chance to catch the same problem after the guard has cleared you. If the refusal persists even with what you believe is the exact text, re-read the file once more, because a stale copy of the region is the usual explanation. Atlas snapshots file changes as git patches, so an approved edit can still be diffed and rolled back.

How to fix it

  1. 01Re-read the file with the read tool and copy the exact text you want replaced, not an approximation of it.
  2. 02Make oldString cover the whole span you intend to replace, so the matched span is no longer disproportionate to it.
  3. 03Do not work around the guard by shrinking oldString further. A smaller oldString makes the fuzzy match worse and widens the span Atlas would have replaced.
  4. 04For multi-hunk changes, use apply_patch instead of forcing one oversized edit through the fuzzy replacers.
  5. 05Re-run edit and confirm Atlas surfaces a unified diff for approval rather than refusing the replacement.

Frequently asked questions

what does refusing replacement because the matched span is much larger than oldString mean in Atlas
It means isDisproportionateMatch caught a fuzzy match that stretched far past the text you supplied. When the matched span is at least max(oldLines + 3, oldLines * 2) lines, Atlas refuses rather than silently deleting a large block of code.
how do I fix a disproportionate match in Atlas edit
Re-read the file and make oldString cover the whole span you intend to replace, copying it exactly. Once oldString and the matched span are the same region, the guard has nothing to refuse.
should I make oldString shorter to avoid the Atlas disproportionate match error
No. A shorter oldString gives the fuzzy replacers less to anchor on and makes the matched span sprawl further, while also lowering the max(oldLines + 3, oldLines * 2) threshold. Grow oldString into the full exact span instead.
what is isDisproportionateMatch in Atlas
isDisproportionateMatch is the guard on the Atlas edit tool's fuzzy replacers. It refuses a replacement when the matched span is at least max(oldLines + 3, oldLines * 2) lines long, preventing a fuzzy match from silently deleting a large block.
how do I make a multi-hunk change in Atlas without hitting this error
Use apply_patch. A change spanning several regions of a file is not one replacement, and forcing it into a single edit is what makes the fuzzy match disproportionate in the first place.
did Atlas change my file when the disproportionate match error fired
No. isDisproportionateMatch refuses the replacement before anything is written, which is the entire point of the guard. Your file is untouched, so re-read it and supply the full exact oldString.
why does Atlas use fuzzy replacers if they can match too much
Fuzzy replacers let an edit succeed despite minor whitespace or indentation drift. isDisproportionateMatch is the counterweight: it bounds how far a fuzzy match may stretch, refusing any span of at least max(oldLines + 3, oldLines * 2) lines.

Try Atlas in your terminal

The terminal-native AI coding agent. Free core, single binary.

Install Atlas

Related guides

Atlas for Dart in 2026

Adopt Atlas, the terminal-native AI coding agent, for Dart development in 2026. Enhance productivity with intelligent code search, refactoring, and robust safety features across your Dart projects.

Atlas with GPT-5.6 Sol: The High Effort GPT-5.6 Variant in 2026

GPT-5.6 Sol tops the 5.6 line at $5 per Mtok input, $30 per Mtok output on a 1,050,000 token window. Atlas setup, small_model routing, and when Sol is overkill.

Atlas vs Amp: Terminal AI Coding Agents in 2026

Compare Atlas, a terminal-native AI coding agent with free core and local embeddings, against Amp, Sourcegraph's agent featuring Oracle and Orbs, for developers in 2026.

Atlas with AllenAI Olmo 3 32B Think: the fully open reasoning model in 2026

Run Atlas on AllenAI Olmo 3 32B Think in 2026: 65,536 token context, OpenRouter $0.15/$0.50 per Mtok, and the only weights, data, and training code you can audit.

Atlas with QwQ Plus: Alibaba's Reasoning Line in the Plan Agent, 2026

Run Atlas on QwQ Plus in 2026. Alibaba's dedicated reasoning tier costs $0.80 per Mtok input, $2.40 per Mtok output, with a 128K tokens (131,072) context.

Atlas with Gemini 2.0 Flash: A Fast Reader With an 8,192 Token Output Cap in 2026

Gemini 2.0 Flash in Atlas: the December 2024 release with a 1,048,576 token context, $0.1 per Mtok input, no reasoning mode, and an 8,192 token output ceiling.

Atlas for JavaScript in 2026

In 2026, Atlas empowers JavaScript developers with a terminal-native AI coding agent. It indexes code by AST, uses local embeddings, and offers permission-gated tools for safe, efficient development.

Atlas with Kimi K2 Thinking Turbo: The 2026 Reasoning Speed Tier

Kimi K2 Thinking Turbo gives Atlas priority serving on a reasoning model at $1.15 per Mtok input and $8.00 per Mtok output, on a 256K tokens (262,144) window.

Browse this resource hub