zed-industries/zed · error
no active repository
Error message
no active repository
What it means
Raised by confirm_mention_for_git_diff when the active project exposes no active repository, meaning there is no git repo context to compute a diff mention against; the returned Task short-circuits with this sentinel error instead of performing any git work.
Solutions
- Ensure a git repository is open as the active workspace before inserting a git-diff mention
- Open a folder containing a .git directory (or a multi-worktree project) so active_repository returns Some
- If the project genuinely has no repo, suggest a plain text or file mention instead of a git-diff mention
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/agent_ui/src/mention_set.rs:685 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/253939178d1240cf.
Report an issue: GitHub.
Appendix: source
Thrown at crates/agent_ui/src/mention_set.rs:685
.unwrap_or_else(|| "No diagnostics found.".into());
Ok(Mention::Text {
content,
tracked_buffers: Vec::new(),
})
})
}
pub fn confirm_mention_for_git_diff(
&self,
base_ref: SharedString,
cx: &mut Context<Self>,
) -> Task<Result<Mention>> {
let Some(project) = self.project.upgrade() else {
return Task::ready(Err(anyhow!("project not found")));
};
let Some(repo) = project.read(cx).active_repository(cx) else {
return Task::ready(Err(anyhow!("no active repository")));
};
let diff_receiver = repo.update(cx, |repo, cx| {
repo.diff(
git::repository::DiffType::MergeBase { base_ref: base_ref },
cx,
)
});
cx.spawn(async move |_, _| {
let diff_text = diff_receiver.await??;
if diff_text.is_empty() {
Ok(Mention::Text {
content: "No changes found in branch diff.".into(),
tracked_buffers: Vec::new(),
})
} else {
Ok(Mention::Text {View on GitHub (pinned to f4178619ac)