Aider error
Aider: SearchReplaceNoExactMatch: This SEARCH block failed to exactly match...
SearchReplaceNoExactMatch: This SEARCH block failed to exactly match lines in {path}Status: WorkaroundLast verified 2 documented fixes2 sources
What it means
In the diff (SEARCH/REPLACE) edit format, the SEARCH section the model sent does not match the current contents of the file, so that block was not applied. Aider's message says: "The SEARCH section must exactly match an existing block of lines including all white space, comments, indentation, docstrings, etc". It may add "Did you mean to match some of these actual lines from {path}?" or "Are you sure you need this SEARCH/REPLACE block? The REPLACE lines are already in {path}!". This is a form of the edit-format failure, and aider sends the message back to the model so it can resend only the failed blocks.
Causes
- The model's SEARCH text differs from the file (whitespace, comments, indentation, docstrings), per aider's own error text in editblock_coder.py.
- The REPLACE lines are already present in the file, so the SEARCH text no longer exists.
- The same root causes listed in the File editing problems doc: the model not following the edit format, too much context, or a weak or quantized model.
How to fix it
- Fix 1.
Follow the File editing problems doc: reduce context with /drop and /clear, use a more capable model, or switch edit formats.
Terminalaider --edit-format whole - Fix 2.
Use architect mode so a separate editor model handles the file edits.
Terminalaider --architect
More Aider errors
All 17 Aider errorsThe LLM did not conform to the edit format.Status: WorkaroundModel gpt-3.5-turbo has hit a token limit!Status: WorkaroundModel foobar: Unknown context window size and costs, using sane defaults.Status: By designModel azure/gpt-4-turbo: Missing these environment variables:Status: By designaider: The term 'aider' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.Status: Workaroundaider-chat 0.23.0 requires somepackage==X.Y.Z, but you have somepackage U.W.V which is incompatible.Status: WorkaroundThe API provider is not able to authenticate you. Check your API key.Status: By designThe API provider has rate limited you. Try again later or check your quotas.Status: By design
Related reading
- Aider vs Claude Code in 2026: Git-First Open Source vs Subagent RuntimeAider vs Claude Code: git-first, model-agnostic Aider against the Claude Code runtime of subagents and hooks. Compare architecture, cost, governance and fit.
- Aider vs Claude Code: Open Source vs Commercial AI Coding CLIAider is open source and works with any model. Claude Code is Anthropic's commercial agent. Here is how they compare for TypeScript.
FAQ
What does "SearchReplaceNoExactMatch: This SEARCH block failed to exactly match..." mean in Aider?
In the diff (SEARCH/REPLACE) edit format, the SEARCH section the model sent does not match the current contents of the file, so that block was not applied. Aider's message says: "The SEARCH section must exactly match an existing block of lines including all white space, comments, indentation, docstrings, etc". It may add "Did you mean to match some of these actual lines from {path}?" or "Are you sure you need this SEARCH/REPLACE block? The REPLACE lines are already in {path}!". This is a form of the edit-format failure, and aider sends the message back to the model so it can resend only the failed blocks.
How do I fix "SearchReplaceNoExactMatch: This SEARCH block failed to exactly match..."?
There are 2 documented fixes. Start with the first: Follow the File editing problems doc: reduce context with /drop and /clear, use a more capable model, or switch edit formats.
Is this Aider error fixed?
Status: Workaround. No release removes the cause. The documented fixes work around it. Affected versions: All versions that use the diff (SEARCH/REPLACE) edit format.
Sources
Last verified against 2 sources: official docs, maintainer replies and release notes.
Newsletter
Fixes for the tools you use, weekly
One email per week. New coding agent releases, what broke, and how developers are working around it.