zed-industries/zed · error

Source workspace is no longer available

Error message

Source workspace is no longer available

What it means

Raised while creating a sibling thread with a fresh worktree: the workspace entity that originated the request was dropped before the new-workspace flow completed. This is a lifecycle guard — the parent workspace (window/project) was closed mid-operation, so its worktrees can no longer be used as the base for the linked git worktree. The fault is the workspace handle going stale, not user input.

Solutions

  1. Keep the source workspace open until the new thread and worktree are created
  2. Retry the create_thread request from a workspace that is still open
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/agent_ui/src/agent_panel.rs:4776 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-08-20). Data as JSON: /api/errors/fd621f73c5351b9f. Report an issue: GitHub.

Appendix: source

Thrown at crates/agent_ui/src/agent_panel.rs:4803

impl AgentPanelSiblingHost {
    pub(crate) fn new(panel: WeakEntity<AgentPanel>, window: gpui::AnyWindowHandle) -> Self {
        Self { panel, window }
    }
}

impl agent::SiblingThreadHost for AgentPanelSiblingHost {
    fn create_sibling_thread(
        &self,
        request: agent::SiblingThreadRequest,
        cx: &mut gpui::AsyncApp,
    ) -> Task<Result<agent::SiblingThreadInfo>> {
        let panel = self.panel.clone();
        let window = self.window;
        cx.spawn(async move |cx| {
            let agent_choice = match request.agent_id.as_deref() {
                None => None,
                Some(id) if id == agent::ZED_AGENT_ID.as_ref() => Some(Agent::NativeAgent),
                Some(id) => {
                    // Reject unknown agent ids up front so the model gets a
                    // structured error pointing at `list_agents_and_models`,
                    // rather than a thread that silently fails to launch in
                    // the user's sidebar.
                    let known = panel
                        .read_with(cx, |panel, cx| {
                            let store = panel.project.read(cx).agent_server_store().clone();
                            store
                                .read(cx)
                                .external_agents()
                                .any(|known_id| known_id.0.as_ref() == id)
                        })
                        .unwrap_or(false);
                    if !known {
                        return Err(anyhow!(
                            "Unknown agent id {id:?}. Call `list_agents_and_models` \
                             to see the agents available for `create_thread`."

View on GitHub (pinned to 916fc2b8cb)