{"record":{"id":"14dade1f18e1e86c","repo":"zed-industries/zed","slug":"failed-to-convert-to-absolute-path","errorCode":null,"errorMessage":"Failed to convert {} to absolute path","messagePattern":"Failed to convert (.+?) to absolute path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent/src/tools/read_file_tool.rs","lineNumber":298,"sourceCode":"            let (project_path, symlink_canonical_target) =\n                project.read_with(cx, |project, cx| {\n                    let resolved =\n                        resolve_project_path(project, &input.path, &canonical_roots, cx)?;\n                    anyhow::Ok(match resolved {\n                        ResolvedProjectPath::Safe(path) => (path, None),\n                        ResolvedProjectPath::SymlinkEscape {\n                            project_path,\n                            canonical_target,\n                        } => (project_path, Some(canonical_target)),\n                    })\n                }).map_err(tool_content_err)?;\n\n            let abs_path = project\n                .read_with(cx, |project, cx| {\n                    project.absolute_path(&project_path, cx)\n                })\n                .ok_or_else(|| {\n                    anyhow!(\"Failed to convert {} to absolute path\", input.path)\n                }).map_err(tool_content_err)?;\n\n            // Check settings exclusions synchronously\n            project.read_with(cx, |_project, cx| {\n                let global_settings = WorktreeSettings::get_global(cx);\n                if global_settings.is_path_excluded(&project_path.path) {\n                    anyhow::bail!(\n                        \"Cannot read file because its path matches the global `file_scan_exclusions` setting: {}\",\n                        input.path\n                    );\n                }\n\n                if global_settings.is_path_private(&project_path.path) {\n                    anyhow::bail!(\n                        \"Cannot read file because its path matches the global `private_files` setting: {}\",\n                        input.path\n                    );\n                }","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/agent/src/tools/read_file_tool.rs#L280-L316","documentation":"read_file first resolves its input to a ProjectPath, then asks Project::absolute_path to map it to a filesystem path. That mapping returns None when the owning worktree cannot produce an absolute path — typically because the worktree was removed from the project or is otherwise unreadable — and the tool aborts with this error before any settings or filesystem checks.","triggerScenarios":"read_file on a path whose worktree was closed or removed from the multi-root project between path resolution and the absolute_path call; a path owned by an inconsistent worktree state.","commonSituations":"A multi-root project where one root folder is closed while an agent request is in flight; project layout changes racing tool calls.","solutions":["Re-open the folder containing the file as a worktree in the project and retry","Retry the request so path resolution runs against the current set of worktrees","Open the file directly in the editor if agent access is not required"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let abs_path = project.read_with(cx, |project, cx| {\n    project.absolute_path(&project_path, cx)\n});\nif abs_path.is_none() {\n    // owning worktree is gone/unreadable; skip the read_file call\n}","typeGuard":null,"tryCatchPattern":"Match 'Failed to convert' in the message and re-resolve the path against the current project state before retrying once.","preventionTips":["In multi-root projects, avoid issuing agent file requests against a root you are about to close","Re-resolve paths after project layout changes instead of reusing stale ProjectPath values"],"tags":["agent","read-file","worktree","absolute-path"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}