zed-industries/zed · error · GitBinaryCommandError

Git command failed:\n{stdout}{stderr}\n

Error message

Git command failed:\n{stdout}{stderr}\n

What it means

A spawned git subprocess (e.g. 'git cat-file blob' in load_blob_content) completed but exited non-zero; the message embeds the command's combined stdout and stderr. This is the generic guard for git child-process failure in repository.rs — the specific git error text in {stdout}{stderr} identifies the root cause (missing object, lock contention, repo corruption).

Source

Thrown at crates/git/src/repository.rs:1559

                        .await?;
                let is_binary = new_object.as_ref().is_some_and(|object| object.is_binary)
                    || old_object.as_ref().is_some_and(|object| object.is_binary);
                let new_content = new_object.map(|object| object.content);
                let old_content = old_object.map(|object| object.content);

                files.push(CommitFile {
                    path: RepoPath(Arc::from(rel_path)),
                    old_content,
                    new_content,
                    is_binary,
                })
            }

            Ok(CommitDiff {
                files,
                is_shallow_boundary: false,
            })
        })
        .boxed()
    }

    fn reset(
        &self,
        commit: String,
        mode: ResetMode,
        env: Arc<HashMap<String, String>>,
    ) -> BoxFuture<'_, Result<()>> {
        let git = self.git_binary_in_worktree();
        async move {
            let git = git?;
            let mode_flag = match mode {
                ResetMode::Mixed => "--mixed",
                ResetMode::Soft => "--soft",
            };

            let output = git

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Read the embedded stdout/stderr to identify git's own diagnosis before acting
  2. For cat-file blob failures, verify the oid exists ('git cat-file -e') — a pruned/gc'd object is a common cause
  3. Retry transient failures (index.lock, remote operations) with a short backoff
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/git/src/repository.rs:1548 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/e8563697018e9863. Report an issue: GitHub.