zed-industries/zed · error
git log failed: {}
Error message
git log failed:
{} What it means
ensure! guard failing when `git log --full-diff --name-only -z --format=%x1e -- <paths>` exits non-zero while loading per-file commit history. Fires for invalid pathspecs, missing HEAD in an empty repo, or corrupt object data.
Source
Thrown at crates/git/src/repository.rs:3480
args.push("--fixed-strings");
if !search_args.case_sensitive {
args.push("--regexp-ignore-case");
}
args.push("--grep");
args.push(search_args.query.as_str());
}
args.extend(log_source_args.iter().map(|arg| arg.as_ref()));
let mut command = git.build_command(&args);
command.stdout(Stdio::piped());
command.stderr(Stdio::null());
let mut child = command.spawn()?;
let stdout = child.stdout.take().context("failed to get stdout")?;
let mut reader = BufReader::new(stdout);
let mut line_buffer = String::new();
loop {
line_buffer.clear();
let bytes_read = reader.read_line(&mut line_buffer).await?;
if bytes_read == 0 {
break;
}
let sha = line_buffer.trim_end_matches('\n');
if let Some(hash_query) = hash_query.as_ref()
&& !sha.to_ascii_lowercase().starts_with(hash_query)
{
continue;
}
if let Ok(oid) = Oid::from_str(sha)View on GitHub (pinned to 5a9b9558db)
Solutions
- Check git stderr for a bad pathspec or missing revision
- Handle empty repositories (no commits yet) by returning no history instead of erroring
- Verify the requested paths exist or existed in the repo
- Retry after repository state stabilizes (e.g. mid-rebase)
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/git/src/repository.rs:3466 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20).
Data as JSON: /api/errors/f3eaeca01241ca70.
Report an issue: GitHub.