{"record":{"id":"fd621f73c5351b9f","repo":"zed-industries/zed","slug":"source-workspace-is-no-longer-available","errorCode":null,"errorMessage":"Source workspace is no longer available","messagePattern":"Source workspace is no longer available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_ui/src/agent_panel.rs","lineNumber":4803,"sourceCode":"\nimpl AgentPanelSiblingHost {\n    pub(crate) fn new(panel: WeakEntity<AgentPanel>, window: gpui::AnyWindowHandle) -> Self {\n        Self { panel, window }\n    }\n}\n\nimpl agent::SiblingThreadHost for AgentPanelSiblingHost {\n    fn create_sibling_thread(\n        &self,\n        request: agent::SiblingThreadRequest,\n        cx: &mut gpui::AsyncApp,\n    ) -> Task<Result<agent::SiblingThreadInfo>> {\n        let panel = self.panel.clone();\n        let window = self.window;\n        cx.spawn(async move |cx| {\n            let agent_choice = match request.agent_id.as_deref() {\n                None => None,\n                Some(id) if id == agent::ZED_AGENT_ID.as_ref() => Some(Agent::NativeAgent),\n                Some(id) => {\n                    // Reject unknown agent ids up front so the model gets a\n                    // structured error pointing at `list_agents_and_models`,\n                    // rather than a thread that silently fails to launch in\n                    // the user's sidebar.\n                    let known = panel\n                        .read_with(cx, |panel, cx| {\n                            let store = panel.project.read(cx).agent_server_store().clone();\n                            store\n                                .read(cx)\n                                .external_agents()\n                                .any(|known_id| known_id.0.as_ref() == id)\n                        })\n                        .unwrap_or(false);\n                    if !known {\n                        return Err(anyhow!(\n                            \"Unknown agent id {id:?}. Call `list_agents_and_models` \\\n                             to see the agents available for `create_thread`.\"","sourceCodeStart":4785,"sourceCodeEnd":4821,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/agent_ui/src/agent_panel.rs#L4785-L4821","documentation":"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.","triggerScenarios":"Thrown at crates/agent_ui/src/agent_panel.rs:4776 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep the source workspace open until the new thread and worktree are created","Retry the create_thread request from a workspace that is still open"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}