zed-industries/zed · error
No worktree for id {worktree_id:?}
Error message
No worktree for id {worktree_id:?} What it means
Returned by restore_entry when no worktree with the given WorktreeId exists in the project (it was removed or the restore refers to a stale id). The trash entry cannot be restored into a nonexistent worktree, so the task resolves with this error.
Source
Thrown at crates/project/src/project.rs:2761
worktree.update(cx, |worktree, cx| worktree.trash_entry(entry_id, cx))
}
#[inline]
pub fn delete_entry(
&mut self,
entry_id: ProjectEntryId,
cx: &mut Context<Self>,
) -> Option<Task<Result<()>>> {
let worktree = self.worktree_for_entry(entry_id, cx)?;
cx.emit(Event::DeletedEntry(worktree.read(cx).id(), entry_id));
worktree.update(cx, |worktree, cx| worktree.delete_entry(entry_id, cx))
}
#[inline]
pub fn restore_entry(
&self,
worktree_id: WorktreeId,
trash_id: TrashId,
cx: &mut Context<'_, Self>,
) -> Task<Result<ProjectPath>> {
let Some(worktree) = self.worktree_for_id(worktree_id, cx) else {
return Task::ready(Err(anyhow!("No worktree for id {worktree_id:?}")));
};
cx.spawn(async move |_, cx| {
let entry = worktree
.update(cx, |worktree, cx| worktree.restore_entry(trash_id, cx))
.await?;
Ok(ProjectPath {
worktree_id: worktree_id,
path: entry.path,
})
})
}
View on GitHub (pinned to 9d272b0363)
Solutions
- Ensure the originating worktree is still open in the workspace
- Retry the restore once the worktree is loaded
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/project/src/project.rs:2748 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/509190cd560bd612.
Report an issue: GitHub.