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

Couldn't get worktree path

Error message

Couldn't get worktree path

What it means

save_scenario asks the workspace for the absolute path of the worktree (needed to locate the task definition file); absolute_path_of_worktree returned None, typically because the worktree no longer exists in the workspace. The worktree_id parameter is the input at fault.

Source

Thrown at crates/debugger_ui/src/debugger_panel.rs:1151

            })?;

            Ok(())
        })
    }

    pub(crate) fn save_scenario(
        &self,
        scenario: DebugScenario,
        worktree_id: WorktreeId,
        window: &mut Window,
        cx: &mut Context<Self>,
    ) -> Task<Result<()>> {
        let this = cx.weak_entity();
        let project = self.project.clone();
        self.workspace
            .update(cx, |workspace, cx| {
                let Some(mut path) = workspace.absolute_path_of_worktree(worktree_id, cx) else {
                    return Task::ready(Err(anyhow!("Couldn't get worktree path")));
                };

                let serialized_scenario = serde_json::to_value(scenario);

                cx.spawn_in(window, async move |workspace, cx| {
                    let serialized_scenario = serialized_scenario?;
                    let fs =
                        workspace.read_with(cx, |workspace, _| workspace.app_state().fs.clone())?;

                    path.push(paths::local_settings_folder_name());
                    if !fs.is_dir(path.as_path()).await {
                        fs.create_dir(path.as_path()).await?;
                    }
                    path.pop();

                    path.push(paths::local_debug_file_relative_path().as_std_path());
                    let path = path.as_path();

View on GitHub (pinned to f4178619ac)

Solutions

  1. Verify the worktree is still open in the workspace
  2. Retry from a panel state where the owning worktree is present
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/debugger_ui/src/debugger_panel.rs:1151 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/de706634cd3f99e0. Report an issue: GitHub.