zed-industries/zed · error
object not found: {}
Error message
object not found: {} What it means
While reading a cat-file --batch response, git answered `<sha> missing`: the object does not exist in the local repository. It was never fetched, was pruned, or the SHA is wrong — this is git stating the object is absent, not a parse failure.
Source
Thrown at crates/git/src/repository.rs:3579
Ok(parse_file_history_changed_files_output(
&stdout,
&paths,
&shallow_boundary_oids,
))
}
.boxed()
}
fn commit_data_reader(&self) -> Result<CommitDataReader> {
let git_binary = self.git_binary();
let (request_tx, request_rx) = async_channel::bounded::<CommitDataRequest>(64);
let task = self.executor.spawn(async move {
if let Err(error) = run_commit_data_reader(git_binary, request_rx).await {
log::error!("commit data reader failed: {error:?}");
}
});
Ok(CommitDataReader {
request_tx,
_task: task,
})
}
fn set_trusted(&self, trusted: bool) {
self.is_trusted
.store(trusted, std::sync::atomic::Ordering::Release);
}
fn is_trusted(&self) -> bool {
self.is_trusted.load(std::sync::atomic::Ordering::Acquire)
}
}
async fn run_commit_data_reader(View on GitHub (pinned to 5a9b9558db)
Solutions
- Fetch the object: `git fetch <remote> <sha>` (requires uploadpack.allowAnySHA1InWant on the server) or fetch the containing ref.
- For shallow clones, deepen or unshallow the repository.
- Pre-validate external SHAs with `git cat-file -e <sha> ^{commit}` and skip objects that are absent.
- Do not persist SHAs that only exist via reflog or unreachable objects.
Defensive patterns
Strategy: validation
Validate before calling
fn object_exists(git: &GitBinary, sha: &str) -> impl Future<Output = bool> + '_ {
async move {
git.run(&["cat-file", "-e", sha]).await.is_ok()
}
}
let loadable: Vec<_> = shas.iter().filter(|s| object_exists(git, s).await).collect(); Try / catch
match load_commits(&shas).await {
Err(e) if e.to_string().contains("object not found") => {
// missing objects are expected for shallow/pruned clones: skip them or fetch first
}
other => other?,
} Prevention
- Treat external SHAs as untrusted: verify presence with `git cat-file -e` before use.
- Unshallow clones when full history is required.
- Avoid depending on reflog-only or unreachable objects; gc can remove them at any time.
When it happens
Trigger: Batch-loading commit data for a SHA that is not in the local object store: shallow clones (object beyond the graft depth), objects pruned by `git gc`, SHAs that exist only on an unfetched remote, or mistyped/truncated SHAs.
Common situations: Opening permalinks or pasted SHAs against a shallow clone; long-lived sessions after a background `git gc --prune` removed unreachable objects; multi-remote projects where the SHA lives only on a remote that is not configured locally.
Related errors
- unexpected number of shas
- revision spec {revision:?} contains a newline and cannot be
- invalid cat-file header: {header_line}
- expected commit object, got {object_type}
- grammar directory '{}' already exists, but is not a git clon
AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20).
Data as JSON: /api/errors/ff3f2e84f323b4f3.
Report an issue: GitHub.