{"record":{"id":"cf5c5be375f26c9d","repo":"zed-industries/zed","slug":"git-command-failed-stdout-stderr","errorCode":null,"errorMessage":"Git command failed:\n{stdout}{stderr}\n","messagePattern":"Git command failed:\n(.+?)(.+?)\n","errorType":"exception","errorClass":"GitBinaryCommandError","httpStatus":null,"severity":"error","filePath":"crates/git/src/repository.rs","lineNumber":1645,"sourceCode":"                let output = command.output().await?;\n                anyhow::ensure!(\n                    output.status.success(),\n                    GitBinaryCommandError {\n                        stdout: String::from_utf8_lossy(&output.stdout).to_string(),\n                        stderr: String::from_utf8_lossy(&output.stderr).to_string(),\n                        status: output.status,\n                    }\n                );\n                Ok(output.stdout)\n            })\n            .boxed()\n    }\n\n    fn load_commit_template(&self) -> BoxFuture<'_, Result<Option<GitCommitTemplate>>> {\n        let working_directory = self.working_directory();\n        let git_binary = self.git_binary_in_worktree();\n\n        self.executor\n            .spawn(async move {\n                let working_directory = working_directory?;\n                let git_binary = git_binary?;\n                let output = git_binary\n                    .build_command(&[\"config\", \"--get\", \"commit.template\"])\n                    .output()\n                    .await\n                    .context(\"failed to run git config --get commit.template\")?;\n\n                let raw_path = String::from_utf8_lossy(&output.stdout).trim().to_string();\n                if !output.status.success() || raw_path.is_empty() {\n                    return Ok(None);\n                }\n\n                let path = PathBuf::from(&raw_path);\n                let path = if let Some(path) = raw_path.strip_prefix(\"~/\") {\n                    paths::home_dir().join(path)\n                } else if path.is_relative() {","sourceCodeStart":1627,"sourceCodeEnd":1663,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/git/src/repository.rs#L1627-L1663","documentation":"Thrown when a spawned `git hash-object -w --stdin --path` child process exits with a non-zero status while computing the blob SHA for a staged file. It wraps the git stdout/stderr and exit status in GitBinaryCommandError, so it fires when git rejects the path (e.g. file missing from disk, outside the worktree, or a bad index state).","triggerScenarios":"Thrown at crates/git/src/repository.rs:1634 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check stderr in the error for git's actual complaint (path not found, bad object, permission denied)","Verify the file still exists on disk and is readable before hashing","Confirm the path is inside the repository worktree and correctly encoded","Retry the operation; transient index/lock contention can cause git to fail"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}