{"record":{"id":"cd8005e5067a18f9","repo":"zed-industries/zed","slug":"failed-to-find-a-git-repository-for-buffer","errorCode":null,"errorMessage":"failed to find a git repository for buffer","messagePattern":"failed to find a git repository for buffer","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/project/src/git_store.rs","lineNumber":2114,"sourceCode":"            Ok(future::try_join_all(tasks)\n                .await?\n                .into_iter()\n                .all(|result| result))\n        })\n    }\n\n    /// Blames a buffer.\n    pub fn blame_buffer(\n        &self,\n        buffer: &Entity<Buffer>,\n        version: Option<clock::Global>,\n        cx: &mut Context<Self>,\n    ) -> Task<Result<Option<Blame>>> {\n        let buffer = buffer.read(cx);\n        let Some((repo, repo_path)) =\n            self.repository_and_path_for_buffer_id(buffer.remote_id(), cx)\n        else {\n            return Task::ready(Err(anyhow!(\"failed to find a git repository for buffer\")));\n        };\n        let content = match &version {\n            Some(version) => buffer.rope_for_version(version),\n            None => buffer.as_rope().clone(),\n        };\n        let line_ending = buffer.line_ending();\n        let version = version.unwrap_or(buffer.version());\n        let buffer_id = buffer.remote_id();\n\n        let repo = repo.downgrade();\n        cx.spawn(async move |_, cx| {\n            let repository_state = repo\n                .update(cx, |repo, _| repo.repository_state.clone())?\n                .await\n                .map_err(|err| anyhow::anyhow!(err))?;\n            match repository_state {\n                RepositoryState::Local(LocalRepositoryState { backend, .. }) => backend\n                    .blame(repo_path.clone(), content, line_ending)","sourceCodeStart":2096,"sourceCodeEnd":2132,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/project/src/git_store.rs#L2096-L2132","documentation":"In Project::blame_buffer: repository_and_path_for_buffer_id returned None, meaning the buffer's file is not tracked by any git repository known to this project's GitStore. Blame cannot be computed for files outside a repository.","triggerScenarios":"Thrown at crates/project/src/git_store.rs:2114 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open the repository containing the file as a project worktree","Ensure the worktree's git repo has been discovered (check for .git and worktree indexing)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}