{"record":{"id":"253939178d1240cf","repo":"zed-industries/zed","slug":"no-active-repository","errorCode":null,"errorMessage":"no active repository","messagePattern":"no active repository","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_ui/src/mention_set.rs","lineNumber":685,"sourceCode":"                .unwrap_or_else(|| \"No diagnostics found.\".into());\n            Ok(Mention::Text {\n                content,\n                tracked_buffers: Vec::new(),\n            })\n        })\n    }\n\n    pub fn confirm_mention_for_git_diff(\n        &self,\n        base_ref: SharedString,\n        cx: &mut Context<Self>,\n    ) -> Task<Result<Mention>> {\n        let Some(project) = self.project.upgrade() else {\n            return Task::ready(Err(anyhow!(\"project not found\")));\n        };\n\n        let Some(repo) = project.read(cx).active_repository(cx) else {\n            return Task::ready(Err(anyhow!(\"no active repository\")));\n        };\n\n        let diff_receiver = repo.update(cx, |repo, cx| {\n            repo.diff(\n                git::repository::DiffType::MergeBase { base_ref: base_ref },\n                cx,\n            )\n        });\n\n        cx.spawn(async move |_, _| {\n            let diff_text = diff_receiver.await??;\n            if diff_text.is_empty() {\n                Ok(Mention::Text {\n                    content: \"No changes found in branch diff.\".into(),\n                    tracked_buffers: Vec::new(),\n                })\n            } else {\n                Ok(Mention::Text {","sourceCodeStart":667,"sourceCodeEnd":703,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/agent_ui/src/mention_set.rs#L667-L703","documentation":"confirm_mention_for_git_diff asks the project for its active git repository via project.active_repository(cx). None means no repository is currently marked active — none of the open worktrees is a git repo, or git detection has not completed/selected one yet — so there is nothing to diff against.","triggerScenarios":"Using a git-diff mention (diff against a base ref) in a folder that is not a git repository; right after opening a project before git status detection finishes; a multi-worktree project where no active repository has been set.","commonSituations":"Plain folders without .git; freshly opened clones before detection completes; remote projects with pending repo detection; worktrees whose .git link is broken so no repo registers.","solutions":["Open the project at a git repository root (or a subdirectory of one).","Wait a moment for git detection to complete, then retry the mention.","In multi-repo projects, interact with the source-control panel once so an active repository is selected.","Surface 'no git repository in this project' in the editor instead of a generic error."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let has_active_repo = project.read(cx).active_repository(cx).is_some();\nif !has_active_repo {\n    // hide or disable the git-diff mention suggestion\n}","typeGuard":null,"tryCatchPattern":"match confirm_task.await {\n    Ok(mention) => { /* attach */ }\n    Err(err) if err.to_string() == \"no active repository\" => {\n        show_user(\"Open a project with a git repository to use diff mentions\")\n    }\n    Err(err) => return Err(err),\n}","preventionTips":["Offer git-diff mentions only when active_repository is Some.","Re-evaluate suggestion availability when git detection completes.","Retry once after detection settles before showing an error."],"tags":["zed","git","mentions","project","agent-ui"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}