{"record":{"id":"d07b7b49f7ab0ccb","repo":"zed-industries/zed","slug":"failed-to-run-git-diff","errorCode":null,"errorMessage":"Failed to run git diff:\n{}","messagePattern":"Failed to run git diff:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git/src/repository.rs","lineNumber":2454,"sourceCode":"\n    fn rename_branch(&self, branch: String, new_name: String) -> BoxFuture<'_, Result<()>> {\n        let git_binary = self.git_binary_in_worktree();\n\n        self.executor\n            .spawn(async move {\n                let git_binary = git_binary?;\n                git_binary\n                    .run(&[\"branch\", \"-m\", &branch, &new_name])\n                    .await?;\n                anyhow::Ok(())\n            })\n            .boxed()\n    }\n\n    fn delete_branch(\n        &self,\n        is_remote: bool,\n        name: String,\n        force: bool,\n    ) -> BoxFuture<'_, Result<()>> {\n        let git_binary = self.git_binary_in_worktree();\n\n        self.executor\n            .spawn(async move {\n                let git_binary = git_binary?;\n                let flag = delete_branch_flag(is_remote, force);\n                git_binary.run(&[\"branch\", flag, &name]).await?;\n                anyhow::Ok(())\n            })\n            .boxed()\n    }\n\n    fn blame(\n        &self,\n        path: RepoPath,\n        content: Rope,","sourceCodeStart":2436,"sourceCodeEnd":2472,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/git/src/repository.rs#L2436-L2472","documentation":"ensure! guard failing when a `git diff` variant (`--staged`, plain, or against a merge base) exits non-zero. The diff text cannot be produced, usually because a ref is invalid, the repository is corrupt, or the worktree is in a broken merge state.","triggerScenarios":"Thrown at crates/git/src/repository.rs:2440 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Examine git stderr in the error for the failing ref or object","Verify HEAD and the base ref exist (`git rev-parse HEAD <base_ref>`)","Check for an in-progress merge/rebase leaving the repo in a bad state","Retry after the user resolves repository state; the failure is usually transient or data-dependent"],"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"}