Aider-AI/aider · error · DiffError
Update File action missing path.
Error message
Update File action missing path.
What it means
Raised by PatchCoder._parse_patch_text when a '*** Update File:' header line has nothing after the colon — the update action has no target path, so there is nothing to attach the subsequent hunks to.
Source
Thrown at aider/coders/patch_coder.py:314
"""
patch = Patch()
index = start_index
fuzz_accumulator = 0
while index < len(lines):
line = lines[index]
norm_line = _norm(line)
if norm_line == "*** End Patch":
index += 1
break # Successfully reached end
# ---------- UPDATE ---------- #
if norm_line.startswith("*** Update File: "):
path = norm_line[len("*** Update File: ") :].strip()
index += 1
if not path:
raise DiffError("Update File action missing path.")
# Optional move target
move_to = None
if index < len(lines) and _norm(lines[index]).startswith("*** Move to: "):
move_to = _norm(lines[index])[len("*** Move to: ") :].strip()
index += 1
if not move_to:
raise DiffError("Move to action missing path.")
if path not in current_files:
raise DiffError(f"Update File Error - missing file content for: {path}")
file_content = current_files[path]
existing_action = patch.actions.get(path)
if existing_action is not None:
# Merge additional UPDATE block into the existing one
if existing_action.type != ActionType.UPDATE:View on GitHub (pinned to 5dc9490bb3)
Solutions
- Complete the header: '*** Update File: relative/path/to/file.py'.
- Check the reply for truncation and re-request the patch if output was cut off.
- Retry with the error fed back to the model so it fills in the path.
- If the intent was a new file, use '*** Add File: path' with full content instead.
Example fix
# before *** Update File: @@ -a +b *** End Patch # after *** Update File: foo.py @@ -a +b *** End Patch
Defensive patterns
Strategy: validation
Validate before calling
import re
def headerless_update_paths(patch_text: str) -> list[str]:
return [l for l in patch_text.splitlines() if re.fullmatch(r"\*\*\* Update File:\s*", l)]
# non-empty → these headers lack paths; fill them in before get_edits() Try / catch
try:
coder.get_edits(patch_text)
except ValueError as e:
if "Update File action missing path" in str(e):
patch_text = fill_in_missing_paths(patch_text) # or re-ask the model
coder.get_edits(patch_text)
else:
raise Prevention
- Lint patches for '*** Update File:' lines with empty targets before applying.
- Treat header-only patches as truncated output and regenerate them.
- Use '*** Add File: path' when the file doesn't exist yet.
When it happens
Trigger: A patch containing the literal line '*** Update File:' (or '*** Update File: ' with only whitespace, since the path is .strip()ed) — usually a model truncating the header or emitting the template before filling in the filename.
Common situations: Templated/partial LLM output where the path placeholder was never replaced; copy-paste edits dropping the filename; token-limit truncation right after the header.
Related errors
- Update File Error - missing file content for: {path}
- Invalid patch line found in update section: {line}
- Invalid line prefix in update section: {line}
- Empty patch section found.
- File referenced in patch not found or could not be read: {re
AI-assisted analysis of Aider-AI/aider@5dc9490bb3 (2026-08-15).
Data as JSON: /api/errors/8abe4317148606df.
Report an issue: GitHub.