zed-industries/zed · error

No worktree for path {project_path:?}

Error message

No worktree for path {project_path:?}

What it means

In Project::create_entry: the supplied ProjectPath references a worktree_id with no matching worktree in the WorktreeStore, so a new file/directory entry cannot be created. Indicates a stale or invalid project path.

Source

Thrown at crates/project/src/project.rs:2618

        let path = SanitizedPath::new(path).as_path();
        let path_style = self.path_style(cx);
        self.worktrees(cx)
            .filter_map(|worktree| {
                let worktree = worktree.read(cx);
                let abs_path = worktree.abs_path();
                let relative_path = path_style.strip_prefix(path, abs_path.as_ref())?;
                let is_subpath =
                    !relative_path.is_empty() && !worktree.is_path_ignored(&relative_path);
                is_subpath.then(|| worktree.is_visible())
            })
            .max()
    }

    pub fn create_entry(
        &mut self,
        project_path: impl Into<ProjectPath>,
        is_directory: bool,
        cx: &mut Context<Self>,
    ) -> Task<Result<CreatedEntry>> {
        let project_path = project_path.into();
        let Some(worktree) = self.worktree_for_id(project_path.worktree_id, cx) else {
            return Task::ready(Err(anyhow!(format!(
                "No worktree for path {project_path:?}"
            ))));
        };
        worktree.update(cx, |worktree, cx| {
            worktree.create_entry(project_path.path, is_directory, None, cx)
        })
    }

    #[inline]
    pub fn copy_entry(
        &mut self,
        entry_id: ProjectEntryId,
        new_project_path: ProjectPath,
        cx: &mut Context<Self>,

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Ensure the worktree containing the path is open and finished loading
  2. Retry the creation after the project loads
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/project/src/project.rs:2605 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/b609794bfa9cb929. Report an issue: GitHub.