zed-industries/zed · error
project path not found for directory mention
Error message
project path not found for directory mention {abs_path:?} What it means
In full_mention_for_directory, the user-supplied absolute directory path could not be mapped to any worktree inside the current project via project_path_for_absolute_path; the directory lies outside all open worktrees (or the worktree scan has not completed), so the directory mention cannot be resolved and the task fails immediately.
Solutions
- Add the directory's parent folder to the project as a worktree and retry the mention
- Use a path that lives inside one of the currently open worktrees
- If the path refers to a deleted/renamed directory, re-index or wait for the worktree snapshot to update before mentioning it
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/agent_ui/src/mention_set.rs:1250 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/66dc2ab49fb4a517.
Report an issue: GitHub.
Appendix: source
Thrown at crates/agent_ui/src/mention_set.rs:1250
} else if entry.is_file() {
files.push((
entry.path.clone(),
worktree
.full_path(&entry.path)
.to_string_lossy()
.to_string(),
));
}
}
files
}
let Some(project_path) = project
.read(cx)
.project_path_for_absolute_path(&abs_path, cx)
else {
return Task::ready(Err(anyhow!(
"project path not found for directory mention {abs_path:?}"
)));
};
let Some(entry) = project.read(cx).entry_for_path(&project_path, cx) else {
return Task::ready(Err(anyhow!("project entry not found")));
};
let directory_path = entry.path.clone();
let worktree_id = project_path.worktree_id;
let Some(worktree) = project.read(cx).worktree_for_id(worktree_id, cx) else {
return Task::ready(Err(anyhow!("worktree not found")));
};
let project = project.clone();
cx.spawn(async move |cx| {
let file_paths = worktree.read_with(cx, |worktree, _cx| {
collect_files_in_path(worktree, &directory_path)
});
let descendants_future = cx.update(|cx| {
futures::future::join_all(file_paths.into_iter().map(View on GitHub (pinned to f4178619ac)