ThinkFacility

Error messages

The LLM did not conform to the edit format.

The message

The LLM did not conform to the edit format.
Aider 0.86.2 read September 26, 2026Aidercoding agentslocal models

What it means

The model replied with an edit Aider couldn't apply, usually a SEARCH block that doesn't match the file's current text exactly. Aider sends the error back to the model and lets it try again, up to three times.

What to do

Let the retry run. If it keeps failing, /drop files you don't need, /clear the history, or restart with --edit-format whole or --architect.

Aider prints this in red after the model's reply, followed by a link and the details:

The LLM did not conform to the edit format.
https://aider.chat/docs/troubleshooting/edit-errors.html

# 1 SEARCH/REPLACE block failed to match!

## SearchReplaceNoExactMatch: This SEARCH block failed to exactly match lines in app.py

We read how it's produced in the Aider v0.86.2 source, the newest release on PyPI (uploaded February 12, 2026). Aider doesn't let the model write files directly. It asks for edits in a set text format and applies them itself, and this line means one of those edits couldn't be applied.

What the SEARCH/REPLACE failure means

In Aider's diff edit format, each change is a block: the lines to find, a divider, and the lines to put in their place. Aider looks for the SEARCH part in the named file (then in the other files in the chat), and it has to be an exact match. The message sent back to the model spells it out: "The SEARCH section must exactly match an existing block of lines including all white space, comments, indentation, docstrings, etc".

So one wrong indent, a comment the model remembered differently, or a file you changed by hand since the model last saw it is enough. Aider tries hard with "almost" matches (its docs say so), but it won't guess. Read the rest of the output, though. When Aider finds similar lines it adds "Did you mean to match some of these actual lines", and when the new code is already there it says "The REPLACE lines are already in" the file, which usually means an earlier attempt worked.

The three retries

You don't have to do anything right away. Aider sends the whole failure text back to the model so it can correct the blocks. That round trip is what Aider calls a reflection, and it allows three per message. After the third you see Only 3 reflections allowed, stopping. Blocks that did match are already written to disk (the message to the model says "Don't re-send them"), so check git diff before re-asking.

What Aider's docs suggest when it keeps happening

The error links to Aider's own troubleshooting page, and its advice is practical.

Send less. The page says that "above about 25k tokens of context, most models start to become distracted". Add only the files that need editing (Aider sends a map of the repo anyway), use /drop on the rest, /clear old conversation, and check /tokens.

Change the format. Starting Aider with --edit-format whole has the model send back the entire file, so there's nothing to match. It costs more output tokens on big files. The startup banner shows which format you're on.

Split the job. --architect (or /chat-mode architect mid-session) has one model plan the change and a second one write the edits, which the docs say "often produces more reliable edits".

Mind local models. Aider's docs are blunt: "Most local models are just barely capable of working with aider." Quantized ones (compressed to fit less memory) do worse, and Ollama's small default context window "silently discards data", so the model may never see the file it's editing. A July 2025 report got the error from an unquantized 671B DeepSeek too, which shows size alone doesn't settle it.

Other lines the same feature prints

Match yours against these if the one at the top of the page is not quite it. They come from the same code and mean related things.

  • SearchReplaceNoExactMatch: This SEARCH block failed to exactly match lines in
  • # 1 SEARCH/REPLACE block failed to match!
  • The SEARCH section must exactly match an existing block of lines including all white space, comments, indentation, docstrings, etc
  • Only 3 reflections allowed, stopping.