zed-industries/zed · error
workspace must exist
Error message
workspace must exist
What it means
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.
Source
Thrown at crates/agent_ui/src/agent_diff.rs:94
let agent_diff = cx
.new(|cx| AgentDiffPane::new(thread.clone(), workspace.weak_handle(), window, cx));
workspace.add_item_to_center(Box::new(agent_diff.clone()), window, cx);
agent_diff
}
}
pub fn new(
thread: Entity<AcpThread>,
workspace: WeakEntity<Workspace>,
window: &mut Window,
cx: &mut Context<Self>,
) -> Self {
let focus_handle = cx.focus_handle();
let multibuffer = cx.new(|_| MultiBuffer::new(Capability::ReadWrite));
let project = thread.read(cx).project().clone();
let editor = cx.new(|cx| {
let workspace_entity = workspace.upgrade().expect("workspace must exist");
let diff_display_editor = SplittableEditor::new(
EditorSettings::get_global(cx).diff_view_style,
multibuffer.clone(),
project.clone(),
workspace_entity,
window,
cx,
);
diff_display_editor
.set_diff_hunk_delegate(Some(agent_diff_delegate(&thread, workspace.clone())), cx);
diff_display_editor.update_editors(cx, |editor, _cx| {
editor.register_addon(AgentDiffAddon);
});
diff_display_editor
});
let action_log = thread.read(cx).action_log().clone();
View on GitHub (pinned to f4178619ac)
Solutions
- Ensure AgentDiffPane is only constructed when a Workspace entity is available
- Upgrade the WeakEntity<Workspace> to a strong handle before constructing the pane
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/agent_ui/src/agent_diff.rs:94 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/6ff62cf49b65d80e.
Report an issue: GitHub.