{"record":{"id":"cfb11de2604e2002","repo":"zed-industries/zed","slug":"unsupported-raw-diff-status-status","errorCode":null,"errorMessage":"unsupported raw diff status {status}","messagePattern":"unsupported raw diff status (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git/src/commit.rs","lineNumber":216,"sourceCode":"fn parse_git_diff_raw_entry<'a>(metadata: &'a str, path: &'a str) -> Result<CommitDiffEntry<'a>> {\n    let mut fields = metadata\n        .strip_prefix(':')\n        .context(\"raw diff metadata is missing its ':' prefix\")?\n        .split_ascii_whitespace();\n    let old_mode = fields.next().context(\"raw diff is missing the old mode\")?;\n    let new_mode = fields.next().context(\"raw diff is missing the new mode\")?;\n    let old_oid = fields\n        .next()\n        .context(\"raw diff is missing the old object ID\")?;\n    let new_oid = fields\n        .next()\n        .context(\"raw diff is missing the new object ID\")?;\n    let status = match fields.next() {\n        Some(\"M\") => StatusCode::Modified,\n        Some(\"T\") => StatusCode::TypeChanged,\n        Some(\"A\") => StatusCode::Added,\n        Some(\"D\") => StatusCode::Deleted,\n        Some(status) => anyhow::bail!(\"unsupported raw diff status {status}\"),\n        None => anyhow::bail!(\"raw diff is missing the status\"),\n    };\n\n    Ok(CommitDiffEntry {\n        path,\n        status,\n        old_object: (!old_oid.bytes().all(|byte| byte == b'0')).then(|| CommitDiffObject {\n            oid: old_oid,\n            kind: if old_mode == GITLINK_MODE {\n                CommitDiffObjectKind::Gitlink\n            } else {\n                CommitDiffObjectKind::Blob\n            },\n        }),\n        new_object: (!new_oid.bytes().all(|byte| byte == b'0')).then(|| CommitDiffObject {\n            oid: new_oid,\n            kind: if new_mode == GITLINK_MODE {\n                CommitDiffObjectKind::Gitlink","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/git/src/commit.rs#L198-L234","documentation":"parse_git_diff_raw_entry parses `git diff --raw -z --no-renames` metadata (:old_mode new_mode old_oid new_oid STATUS) and only maps the status letters M, T, A, D onto StatusCode. Any other status token bails with the token included. The invoking commands pass --no-renames, so C/R normally never appear; the realistic triggers are unmerged (U*/AA/DD...) entries from diffing against a conflicted worktree and exotic statuses (X, B).","triggerScenarios":"DiffTreeType::MergeBaseWithWorktree runs `git diff --raw -z --merge-base <base>` against a worktree with unresolved merge conflicts, producing lines like ':000000 100644 ... AA' or ':100644 100644 ... UU'; the parser hits 'AA'/'UU' and bails.","commonSituations":"Opening the diff/commit view while a merge or rebase is mid-conflict; or a git config/tool emitting rename/copy statuses despite --no-renames.","solutions":["Resolve or abort the in-progress merge/rebase/cherry-pick so the worktree has no unmerged index entries, then retry","If you control the code, extend the match to map unmerged/copy/rename tokens (e.g. s.starts_with('U'), 'C*', 'R*') onto an existing StatusCode instead of bailing","Verify with `git diff --raw -z --no-renames --merge-base <base>` in the repo to see the offending status letter"],"exampleFix":"// before\nSome(status) => anyhow::bail!(\"unsupported raw diff status {status}\"),\n\n// after — collapse statuses the enum cannot distinguish\nSome(\"U\") | Some(\"X\") | Some(\"B\") => StatusCode::Modified,\nSome(s) if s.starts_with('U') || s.starts_with('C') || s.starts_with('R') => StatusCode::Modified,","handlingStrategy":"type-guard","validationCode":"// before consuming parse_git_diff_raw entries\nfor entry in parse_git_diff_raw(&stdout) {\n    let entry = entry?; // guard: filter or map unsupported statuses before constructing CommitDiffEntry\n}","typeGuard":"fn is_supported_raw_status(status: &str) -> bool {\n    matches!(status, \"M\" | \"T\" | \"A\" | \"D\")\n}","tryCatchPattern":"match entry {\n    Ok(parsed) => { /* ... */ }\n    Err(e) if e.to_string().contains(\"unsupported raw diff status\") => { /* skip entry; likely unmerged index */ }\n    Err(e) => return Err(e),\n}","preventionTips":["Avoid diffing against a conflicted worktree; resolve or abort merges first","If unmerged entries are expected in your flow, extend the status match instead of relying on --no-renames to filter everything"],"tags":["git","diff","parse","merge-conflict"],"backgroundTag":"git-output-parse-error","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}