zed-industries/zed · error · anyhow::Error

Source workspace is no longer available

Error message

Source workspace is no longer available

What it means

Error "Source workspace is no longer available" thrown in zed-industries/zed.

Source

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

                title: Some(title.clone()),
                initial_content: Some(initial_content),
                agent: agent_choice.clone(),
                model: request.model.clone(),
                work_dirs: None,
            };

            // If the caller asked for a fresh worktree, open a new workspace
            // backed by a linked git worktree of each git repo in the parent
            // project — the same flow the user gets when they pick "Create
            // worktree" from the worktree picker. The sibling thread is then
            // created inside the new workspace's agent panel, so it lives
            // alongside any threads the user would create there manually.
            let mut worktree_warning: Option<String> = None;
            let target_panel = if request.use_new_worktree {
                let workspace = panel.read_with(cx, |panel, _cx| panel.workspace.clone())?;
                let workspace = workspace
                    .upgrade()
                    .ok_or_else(|| anyhow!("Source workspace is no longer available"))?;
                // The branch target follows the existing UI semantics: when
                // `base_ref` is set, treat it as the ref to base off of
                // (resolved like `git switch --detach <ref>`); otherwise base
                // off the current HEAD. Either way the new worktrees are in
                // detached HEAD state — the agent can attach to a branch via
                // git afterwards.
                let branch_target = match request.base_ref.as_ref() {
                    Some(ref_name) => zed_actions::NewWorktreeBranchTarget::ExistingBranch {
                        name: ref_name.clone(),
                    },
                    None => zed_actions::NewWorktreeBranchTarget::CurrentBranch,
                };
                let action = zed_actions::CreateWorktree {
                    worktree_name: request.worktree_name.clone(),
                    branch_target,
                };
                let creation = window.update(cx, |_root, window, cx| {
                    workspace.update(cx, |workspace, cx| {

View on GitHub (pinned to bc538def45)

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@bc538def45 (2026-08-16). Data as JSON: /api/errors/fd621f73c5351b9f. Report an issue: GitHub.