Aider-AI/aider · error · DiffError

Delete File action missing path.

Error message

Delete File action missing path.

What it means

Thrown by PatchCoder's patch parser when a '*** Delete File:' header line has no path after the colon (empty or whitespace-only). The parser strips the prefix and checks that a non-empty path remains before creating a DELETE PatchAction. It signals malformed model output rather than a filesystem problem.

Source

Thrown at aider/coders/patch_coder.py:361

                        existing_action.move_path = move_to
                    fuzz_accumulator += fuzz
                else:
                    # First UPDATE block for this file
                    action, index, fuzz = self._parse_update_file_sections(
                        lines, index, file_content
                    )
                    action.path = path
                    action.move_path = move_to
                    patch.actions[path] = action
                    fuzz_accumulator += fuzz
                continue

            # ---------- DELETE ---------- #
            elif norm_line.startswith("*** Delete File: "):
                path = norm_line[len("*** Delete File: ") :].strip()
                index += 1
                if not path:
                    raise DiffError("Delete File action missing path.")
                existing_action = patch.actions.get(path)
                if existing_action:
                    if existing_action.type == ActionType.DELETE:
                        # Duplicate delete – ignore the extra block
                        self.io.tool_warning(f"Duplicate delete action for file: {path} ignored.")
                        continue
                    else:
                        raise DiffError(f"Conflicting actions for file: {path}")
                if path not in current_files:
                    raise DiffError(
                        f"Delete File Error - file not found: {path}"
                    )  # Check against known files

                patch.actions[path] = PatchAction(type=ActionType.DELETE, path=path)
                continue

            # ---------- ADD ---------- #
            elif norm_line.startswith("*** Add File: "):

View on GitHub (pinned to 5dc9490bb3)

Solutions

  1. Regenerate the patch ensuring every '*** Delete File: <path>' header includes a real relative path
  2. If driving the parser programmatically, validate patch headers with a regex before calling the coder
  3. Catch DiffError and retry the edit request with the offending patch text echoed back so the model can self-correct

Example fix

// before
*** Delete File: 

// after
*** Delete File: src/old_module.py
Defensive patterns

Strategy: validation

Validate before calling

import re

def patch_delete_headers_valid(patch_text: str) -> bool:
    for line in patch_text.splitlines():
        if line.startswith("*** Delete File: "):
            if not line[len("*** Delete File: "):].strip():
                return False
    return True

Try / catch

from aider.coders.patch_coder import PatchCoder
try:
    edits = coder.get_edits(reply)
except DiffError as e:
    if "Delete File action missing path" in str(e):
        reply = regenerate_patch(reply)  # ask model to fix header
        edits = coder.get_edits(reply)
    else:
        raise

Prevention

When it happens

Trigger: A model emits '*** Delete File: ' with nothing after it (or trailing spaces only) inside a patch block fed to PatchCoder.get_edits/parse. Calling the coder with a hand-written patch that truncates the header also triggers it.

Common situations: LLM responses truncated by token limits mid-header; copy-pasted patches that lose the filename; prompts that fail to show a valid Delete File example so the model invents an empty one.

Related errors


AI-assisted analysis of Aider-AI/aider@5dc9490bb3 (2026-08-15). Data as JSON: /api/errors/8e7619091690853e. Report an issue: GitHub.