{"record":{"id":"25ebbf1ebdd3f4d1","repo":"zed-industries/zed","slug":"is-ambiguous-in-multi-root-workspaces-please","errorCode":null,"errorMessage":"'.' is ambiguous in multi-root workspaces. Please specify a root directory explicitly.","messagePattern":"'\\.' is ambiguous in multi-root workspaces\\. Please specify a root directory explicitly\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent/src/tools/terminal_tool.rs","lineNumber":1349,"sourceCode":"                        \"Command terminated unexpectedly. Output captured:\\n\\n{}\",\n                        content\n                    )\n                }\n            }\n        }\n    };\n    content\n}\n\nfn working_dir(cd: &str, project: &Entity<Project>, cx: &mut App) -> Result<Option<PathBuf>> {\n    let project = project.read(cx);\n\n    if cd == \".\" || cd.is_empty() {\n        let mut worktrees = project.worktrees(cx);\n\n        match worktrees.next() {\n            Some(worktree) => {\n                anyhow::ensure!(\n                    worktrees.next().is_none(),\n                    \"'.' is ambiguous in multi-root workspaces. Please specify a root directory explicitly.\",\n                );\n                Ok(Some(worktree.read(cx).abs_path().to_path_buf()))\n            }\n            None => Ok(None),\n        }\n    } else {\n        let path_style = project.path_style(cx);\n        let worktree_roots = project\n            .worktrees(cx)\n            .filter_map(|worktree| {\n                let worktree = worktree.read(cx);\n                // Skip single-file worktrees: a file can't be a working directory.\n                let root_dir = worktree.root_dir()?;\n                Some((worktree.root_name_str(), root_dir.to_path_buf()))\n            })\n            .collect::<Vec<_>>();","sourceCodeStart":1331,"sourceCodeEnd":1367,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/agent/src/tools/terminal_tool.rs#L1331-L1367","documentation":"working_dir for the terminal tool: the model passed \".\" (or empty) as the working directory in a multi-root workspace, where the first worktree is ambiguous, so an explicit root directory is required.","triggerScenarios":"Thrown at crates/agent/src/tools/terminal_tool.rs:1349 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an explicit root directory path instead of '.' or an empty cd string","Use the absolute path of the intended worktree root when the workspace has multiple roots"],"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-23T08:17:48.524Z"}