{"record":{"id":"6ff62cf49b65d80e","repo":"zed-industries/zed","slug":"workspace-must-exist","errorCode":null,"errorMessage":"workspace must exist","messagePattern":"workspace must exist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_ui/src/agent_diff.rs","lineNumber":94,"sourceCode":"            let agent_diff = cx\n                .new(|cx| AgentDiffPane::new(thread.clone(), workspace.weak_handle(), window, cx));\n            workspace.add_item_to_center(Box::new(agent_diff.clone()), window, cx);\n            agent_diff\n        }\n    }\n\n    pub fn new(\n        thread: Entity<AcpThread>,\n        workspace: WeakEntity<Workspace>,\n        window: &mut Window,\n        cx: &mut Context<Self>,\n    ) -> Self {\n        let focus_handle = cx.focus_handle();\n        let multibuffer = cx.new(|_| MultiBuffer::new(Capability::ReadWrite));\n\n        let project = thread.read(cx).project().clone();\n        let editor = cx.new(|cx| {\n            let workspace_entity = workspace.upgrade().expect(\"workspace must exist\");\n            let diff_display_editor = SplittableEditor::new(\n                EditorSettings::get_global(cx).diff_view_style,\n                multibuffer.clone(),\n                project.clone(),\n                workspace_entity,\n                window,\n                cx,\n            );\n            diff_display_editor\n                .set_diff_hunk_delegate(Some(agent_diff_delegate(&thread, workspace.clone())), cx);\n            diff_display_editor.update_editors(cx, |editor, _cx| {\n                editor.register_addon(AgentDiffAddon);\n            });\n            diff_display_editor\n        });\n\n        let action_log = thread.read(cx).action_log().clone();\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/agent_ui/src/agent_diff.rs#L76-L112","documentation":"Guard in AgentDiffPane::new asserting the pane is always constructed with a live workspace; at the call site the workspace is known to exist because the pane is only created from an open workspace window. Firing would mean a caller violated that invariant.","triggerScenarios":"Thrown at crates/agent_ui/src/agent_diff.rs:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure AgentDiffPane is only constructed when a Workspace entity is available","Upgrade the WeakEntity<Workspace> to a strong handle before constructing the pane"],"exampleFix":null,"handlingStrategy":"type-guard","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"}