{"record":{"id":"171a1daa07b8c62f","repo":"zed-industries/zed","slug":"path-could-not-be-resolved-in-the-project","errorCode":null,"errorMessage":"Path {} could not be resolved in the project","messagePattern":"Path (.+?) could not be resolved in the project","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent/src/tools/tool_permissions.rs","lineNumber":448,"sourceCode":"    // For missing/create-mode paths (or external descendants without their own\n    // canonical_path), resolve symlink safety through snapshot metadata rather\n    // than std::fs canonicalization. This keeps behavior correct for non-local\n    // worktrees and in-memory fs backends.\n    for ancestor in project_path.path.ancestors() {\n        let Some(ancestor_entry) = snapshot.entry_for_path(ancestor) else {\n            continue;\n        };\n\n        if !ancestor_entry.is_external {\n            return Ok(ResolvedProjectPath::Safe(project_path));\n        }\n\n        let Some(canonical_ancestor) = ancestor_entry.canonical_path.as_ref() else {\n            continue;\n        };\n\n        let suffix = project_path.path.strip_prefix(ancestor).map_err(|_| {\n            anyhow!(\n                \"Path {} could not be resolved in the project\",\n                path.display()\n            )\n        })?;\n\n        let canonical_target = if suffix.is_empty() {\n            canonical_ancestor.to_path_buf()\n        } else {\n            canonical_ancestor.join(suffix.as_std_path())\n        };\n\n        if is_within_any_worktree(&canonical_target, canonical_worktree_roots) {\n            return Ok(ResolvedProjectPath::Safe(project_path));\n        }\n\n        return Ok(ResolvedProjectPath::SymlinkEscape {\n            project_path,\n            canonical_target,","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/agent/src/tools/tool_permissions.rs#L430-L466","documentation":"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.","triggerScenarios":"Thrown at crates/agent/src/tools/tool_permissions.rs:448 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}