{"record":{"id":"8abe4317148606df","repo":"Aider-AI/aider","slug":"update-file-action-missing-path","errorCode":null,"errorMessage":"Update File action missing path.","messagePattern":"Update File action missing path\\.","errorType":"exception","errorClass":"DiffError","httpStatus":null,"severity":"error","filePath":"aider/coders/patch_coder.py","lineNumber":314,"sourceCode":"        \"\"\"\n        patch = Patch()\n        index = start_index\n        fuzz_accumulator = 0\n\n        while index < len(lines):\n            line = lines[index]\n            norm_line = _norm(line)\n\n            if norm_line == \"*** End Patch\":\n                index += 1\n                break  # Successfully reached end\n\n            # ---------- UPDATE ---------- #\n            if norm_line.startswith(\"*** Update File: \"):\n                path = norm_line[len(\"*** Update File: \") :].strip()\n                index += 1\n                if not path:\n                    raise DiffError(\"Update File action missing path.\")\n\n                # Optional move target\n                move_to = None\n                if index < len(lines) and _norm(lines[index]).startswith(\"*** Move to: \"):\n                    move_to = _norm(lines[index])[len(\"*** Move to: \") :].strip()\n                    index += 1\n                    if not move_to:\n                        raise DiffError(\"Move to action missing path.\")\n\n                if path not in current_files:\n                    raise DiffError(f\"Update File Error - missing file content for: {path}\")\n\n                file_content = current_files[path]\n\n                existing_action = patch.actions.get(path)\n                if existing_action is not None:\n                    # Merge additional UPDATE block into the existing one\n                    if existing_action.type != ActionType.UPDATE:","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/Aider-AI/aider/blob/5dc9490bb35f9729ef2c95d00a19ccd30c26339c/aider/coders/patch_coder.py#L296-L332","documentation":"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.","triggerScenarios":"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.","commonSituations":"Templated/partial LLM output where the path placeholder was never replaced; copy-paste edits dropping the filename; token-limit truncation right after the header.","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."],"exampleFix":"# before\n*** Update File:\n@@\n-a\n+b\n*** End Patch\n\n# after\n*** Update File: foo.py\n@@\n-a\n+b\n*** End Patch","handlingStrategy":"validation","validationCode":"import re\n\ndef headerless_update_paths(patch_text: str) -> list[str]:\n    return [l for l in patch_text.splitlines() if re.fullmatch(r\"\\*\\*\\* Update File:\\s*\", l)]\n# non-empty → these headers lack paths; fill them in before get_edits()","typeGuard":null,"tryCatchPattern":"try:\n    coder.get_edits(patch_text)\nexcept ValueError as e:\n    if \"Update File action missing path\" in str(e):\n        patch_text = fill_in_missing_paths(patch_text)  # or re-ask the model\n        coder.get_edits(patch_text)\n    else:\n        raise","preventionTips":["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."],"tags":["aider","patch-format","parsing","path"],"backgroundTag":null,"analyzedSha":"5dc9490bb35f9729ef2c95d00a19ccd30c26339c","analyzedAt":"2026-08-15T05:40:10.498Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}