zed-industries/zed · error
Path {} could not be resolved in the project
Error message
Path {} could not be resolved in the project What it means
resolve_project_path walked ancestors in the worktree snapshot and none matched a non-external entry, so the path (likely an external file or broken symlink target) cannot be confirmed as inside the project and is rejected.
Source
Thrown at crates/agent/src/tools/tool_permissions.rs:448
// For missing/create-mode paths (or external descendants without their own
// canonical_path), resolve symlink safety through snapshot metadata rather
// than std::fs canonicalization. This keeps behavior correct for non-local
// worktrees and in-memory fs backends.
for ancestor in project_path.path.ancestors() {
let Some(ancestor_entry) = snapshot.entry_for_path(ancestor) else {
continue;
};
if !ancestor_entry.is_external {
return Ok(ResolvedProjectPath::Safe(project_path));
}
let Some(canonical_ancestor) = ancestor_entry.canonical_path.as_ref() else {
continue;
};
let suffix = project_path.path.strip_prefix(ancestor).map_err(|_| {
anyhow!(
"Path {} could not be resolved in the project",
path.display()
)
})?;
let canonical_target = if suffix.is_empty() {
canonical_ancestor.to_path_buf()
} else {
canonical_ancestor.join(suffix.as_std_path())
};
if is_within_any_worktree(&canonical_target, canonical_worktree_roots) {
return Ok(ResolvedProjectPath::Safe(project_path));
}
return Ok(ResolvedProjectPath::SymlinkEscape {
project_path,
canonical_target,View on GitHub (pinned to f4178619ac)
Solutions
- Verify every ancestor directory of the path is present in the worktree snapshot
- For newly created files, ensure the parent directories are indexed by the project
- Refresh the worktree snapshot and retry the resolution
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/agent/src/tools/tool_permissions.rs:448 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/171a1daa07b8c62f.
Report an issue: GitHub.