{"record":{"id":"2884cdf38023c8d8","repo":"zed-industries/zed","slug":"git-blame-process-failed-stderr","errorCode":null,"errorMessage":"git blame process failed: {stderr}","messagePattern":"git blame process failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git/src/blame.rs","lineNumber":189,"sourceCode":"        Result::<String>::Ok(stderr_output)\n    };\n\n    let wait_for_status = async {\n        child\n            .status()\n            .await\n            .context(\"waiting for git blame process\")\n    };\n\n    let ((), entries, stderr, status) =\n        try_join!(write_stdin, read_stdout, read_stderr, wait_for_status)?;\n\n    if !status.success() {\n        let trimmed = stderr.trim();\n        if trimmed == GIT_BLAME_NO_COMMIT_ERROR || trimmed.contains(GIT_BLAME_NO_PATH) {\n            return Ok(Vec::new());\n        }\n        anyhow::bail!(\"git blame process failed: {stderr}\");\n    }\n\n    Ok(entries)\n}\n\n#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]\npub struct BlameEntry {\n    pub sha: Oid,\n\n    pub range: Range<u32>,\n\n    pub original_line_number: u32,\n\n    pub author: Option<String>,\n    pub author_mail: Option<String>,\n    pub author_time: Option<i64>,\n    pub author_tz: Option<String>,\n","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/git/src/blame.rs#L171-L207","documentation":"After driving git blame to completion (stdin written, stdout/stderr drained, status awaited), a non-zero exit whose stderr is neither the sentinel for an unborn HEAD (\"fatal: no such ref\" family) nor a missing-path error bails with the raw stderr. The two sentinels are deliberately downgraded to Ok(Vec::new()) — everything else is treated as a real failure.","triggerScenarios":"Repository::blame running `git blame` where git fails for reasons other than empty HEAD/missing path: corrupt object database, blaming a gitlink/submodule path, a pathspec that needs disambiguation, or a git version emitting unexpected output/errors.","commonSituations":"Repos with gc/prune corruption, blame invoked on a submodule mount point, older/newer git with changed fatal messages that miss the sentinel match, or worktrees with stale indexes.","solutions":["Reproduce manually: run the same `git blame ... <path>` in the worktree and read stderr","Run `git fsck` and `git status` to rule out a corrupted object database or index","If the target is a submodule/gitlink, exclude it from blame requests","Update/downgrade git to a version whose behavior matches the parser, or extend the sentinel handling upstream"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match repo.blame(&path, client).await {\n    Ok(entries) => Ok(entries),\n    Err(e) if e.to_string().contains(\"git blame process failed\") => { /* surface stderr, skip blame UI */ }\n    Err(e) => Err(e),\n}","preventionTips":["Keep repositories healthy (git fsck after aggressive gc/prune)","Don't blame submodule/gitlink paths; blame is only meaningful for tracked blobs"],"tags":["git","blame","process","stderr"],"backgroundTag":"git-command-failed","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"}