zed-industries/zed · error · anyhow::Error
'git show' failed with error {:?}
Error message
'git show' failed with error {:?} What it means
The 'git show -s --format=%B<MARKER> <shas>' subprocess used to fetch commit messages exited non-zero ({error} is the process Output). Typically one of the requested SHAs does not exist in the repository (bad object), or the repo is corrupt; the ensure! guard fails the whole get_messages batch.
Source
Thrown at crates/git/src/commit.rs:145
};
result.entry(sha).or_default().push(tag_name.to_string());
}
result.retain(|sha, _| shas.contains(sha));
result
}
async fn get_messages_impl(git: &GitBinary, shas: &[Oid]) -> Result<Vec<String>> {
const MARKER: &str = "<MARKER>";
let output = git
.build_command(&["show"])
.arg("-s")
.arg(format!("--format=%B{}", MARKER))
.args(shas.iter().map(ToString::to_string))
.output()
.await
.context("starting git show process")?;
anyhow::ensure!(
output.status.success(),
"'git show' failed with error {:?}",
String::from_utf8_lossy(&output.stderr)
);
Ok(String::from_utf8_lossy(&output.stdout)
.trim()
.split_terminator(MARKER)
.map(|str| str.trim().replace("<", "<").replace(">", ">"))
.collect::<Vec<_>>())
}
pub(crate) const GITLINK_MODE: &str = "160000";
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum CommitDiffObjectKind {
Blob,
Gitlink,
}View on GitHub (pinned to f4178619ac)
Solutions
- Verify all requested SHAs exist ('git cat-file -e <sha>') before batching them into one git show call
- Surface the captured stderr — 'bad object' names the offending SHA
- Split the batch and retry per-sha to isolate which commit is unreadable
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/git/src/commit.rs:145 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/ad902b58542ba527.
Report an issue: GitHub.