﻿# Aider edit-format errors separate proposed code from applied files

Diagnose Aider patch-application failures by checking the selected edit protocol and actual repository changes, separating proposed source code from an applied and validated edit.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-aider-edit-format-application/
Language: en

## Separate proposal from application

Aider displays a plausible replacement function, yet the repository still contains the old code. This can be a patch-application failure rather than a misunderstanding of the algorithm. The [editing-problems guide](https://aider.chat/docs/troubleshooting/edit-errors.html) describes responses whose changes cannot be applied because they do not match the expected format. Inspect the application error and the actual file before asking the model to explain the same solution again.

## Understand the whole-file protocol

The [edit-format reference](https://aider.chat/docs/more/edit-formats.html) describes `whole` as returning a complete updated copy of each changed source file, identified by a path and fenced content. It can be simpler for a model to express, while requiring more output when a large file changes slightly. A complete file is necessary under that protocol; a sketch with omitted unchanged sections is not equivalent to the intended source replacement.

## Understand the search-and-replace protocol

The `diff` format uses file paths and search/replace blocks specifying the old and new text. It reduces repeated output but requires a conforming instruction the application can match to the file. Related formats differ in fencing or protocol details. Do not treat arbitrary familiar-looking unified diff text as interchangeable with every selected format. Keep the current source version available, because a proposed search block based on stale text may not identify the intended location.

## Check the configured format and context

The [options reference](https://aider.chat/docs/config/options.html) provides `--edit-format` independently of model selection. The troubleshooting guide recommends inspecting the startup announcement and reducing unrelated context when diagnosing formatting failures. Treat old model examples as historical illustrations rather than a current ranking. Compare the selected protocol with what the response actually returned, then inspect the error; changing providers before locating that mismatch can obscure the original cause without establishing a usable patch.

## Verify the resulting behavior after application

A successfully applied edit still needs diff review and the task's relevant checks. The [tool-observation guide](/journal/learn-codex-tool-observation/) distinguishes model output, file mutation, and process results. The [task-contract guide](/journal/learn-codex-task-contract/) defines the behavior the patch must satisfy. Keep those milestones separate in a handoff: proposed, applied, and verified. A syntactically acceptable editing instruction can modify the wrong behavior, just as a correct proposed algorithm can fail to modify any file.
