zed-industries/zed · error
git blame process failed: {stderr}
Error message
git blame process failed: {stderr} What it means
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.
Source
Thrown at crates/git/src/blame.rs:189
Result::<String>::Ok(stderr_output)
};
let wait_for_status = async {
child
.status()
.await
.context("waiting for git blame process")
};
let ((), entries, stderr, status) =
try_join!(write_stdin, read_stdout, read_stderr, wait_for_status)?;
if !status.success() {
let trimmed = stderr.trim();
if trimmed == GIT_BLAME_NO_COMMIT_ERROR || trimmed.contains(GIT_BLAME_NO_PATH) {
return Ok(Vec::new());
}
anyhow::bail!("git blame process failed: {stderr}");
}
Ok(entries)
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct BlameEntry {
pub sha: Oid,
pub range: Range<u32>,
pub original_line_number: u32,
pub author: Option<String>,
pub author_mail: Option<String>,
pub author_time: Option<i64>,
pub author_tz: Option<String>,
View on GitHub (pinned to f4178619ac)
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
Defensive patterns
Strategy: try-catch
Try / catch
match repo.blame(&path, client).await {
Ok(entries) => Ok(entries),
Err(e) if e.to_string().contains("git blame process failed") => { /* surface stderr, skip blame UI */ }
Err(e) => Err(e),
} Prevention
- Keep repositories healthy (git fsck after aggressive gc/prune)
- Don't blame submodule/gitlink paths; blame is only meaningful for tracked blobs
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- git status failed: {stderr}
- git diff-tree failed: {stderr}
- git merge-base failed: {stderr}
- git worktree list failed: {stderr}
- git worktree add failed: {stderr}
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/2884cdf38023c8d8.
Report an issue: GitHub.