{"record":{"id":"564e31e2bf57c805","repo":"zed-industries/zed","slug":"git-show-failed","errorCode":null,"errorMessage":"git show failed: {}","messagePattern":"git show failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/git/src/repository.rs","lineNumber":1414,"sourceCode":"            urls.insert(name.to_string(), url.trim_start().to_string());\n        }\n    }\n    urls\n}\n\nimpl GitRepository for RealGitRepository {\n    fn path(&self) -> PathBuf {\n        self.git_dir.clone()\n    }\n\n    fn main_repository_path(&self) -> PathBuf {\n        self.common_dir.clone()\n    }\n\n    fn show(&self, commit: String) -> BoxFuture<'_, Result<CommitDetails>> {\n        let git = self.git_binary();\n        self.executor\n            .spawn(async move {\n                let output = git\n                    .build_command(&[\n                        \"show\",\n                        \"--no-patch\",\n                        \"--format=%H%x00%B%x00%at%x00%ae%x00%an%x00\",\n                        &commit,\n                        // `commit` reaches here as whatever the user typed, so it can name\n                        // a branch that also names a path in the working tree.\n                        \"--\",\n                    ])\n                    .output()\n                    .await?;\n                let output = std::str::from_utf8(&output.stdout)?;\n                let fields = output.split('\\0').collect::<Vec<_>>();\n                if fields.len() != 6 {\n                    bail!(\"unexpected git-show output for {commit:?}: {output:?}\")\n                }\n                let sha = fields[0].to_string().into();","sourceCodeStart":1396,"sourceCodeEnd":1432,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/git/src/repository.rs#L1396-L1432","documentation":"The 'git show --format= -z --raw' subprocess used to load a commit's diff exited non-zero; the ensure! formats git's own output ({}) into the error. The commit argument is likely unknown to this repository, or the repo/worktree state is broken, so the raw diff for the commit could not be obtained.","triggerScenarios":"Thrown at crates/git/src/repository.rs:1407 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include the captured stdout/stderr in logs to expose git's diagnosis (bad object, not a git repo)","Validate the commit sha exists before requesting its diff","Retry once for transient worktree/index lock contention"],"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"}