zed-industries/zed · error

failed to read workspace

Error message

failed to read workspace

What it means

Returned by spawn_task when self.workspace fails to upgrade — the owning Workspace entity was dropped while the terminal panel still holds a weak handle. Without the workspace, the task's project/cwd cannot be resolved, so the spawn aborts immediately.

Source

Thrown at crates/terminal_view/src/terminal_panel.rs:543

                    panel.add_terminal_shell(
                        Some(action.working_directory.clone()),
                        RevealStrategy::Always,
                        window,
                        cx,
                    )
                }
            })
            .detach_and_log_err(cx);
    }

    pub fn spawn_task(
        &mut self,
        task: &SpawnInTerminal,
        window: &mut Window,
        cx: &mut Context<Self>,
    ) -> Task<Result<WeakEntity<Terminal>>> {
        let Some(workspace) = self.workspace.upgrade() else {
            return Task::ready(Err(anyhow!("failed to read workspace")));
        };

        let project = workspace.read(cx).project().read(cx);

        if project.is_via_collab() {
            return Task::ready(Err(anyhow!("cannot spawn tasks as a guest")));
        }

        let remote_client = project.remote_client();
        let is_windows = project.path_style(cx).is_windows();
        let remote_shell = remote_client
            .as_ref()
            .and_then(|remote_client| remote_client.read(cx).shell());

        let shell = if let Some(remote_shell) = remote_shell
            && task.shell == Shell::System
        {
            Shell::Program(remote_shell)

View on GitHub (pinned to f4178619ac)

Solutions

  1. Retry the task spawn while the workspace is open
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/terminal_view/src/terminal_panel.rs:543 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/28310b516cddb472. Report an issue: GitHub.