{"record":{"id":"84ac090f1fbc681d","repo":"zed-industries/zed","slug":"git-worktree-directory-must-be-a-relative-path-go","errorCode":null,"errorMessage":"git.worktree_directory must be a relative path, got: {worktree_directory_setting:?}","messagePattern":"git\\.worktree_directory must be a relative path, got: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/project/src/git_store.rs","lineNumber":10510,"sourceCode":"\n                        let mut changed_path_statuses = Vec::new();\n                        let prev_statuses = prev_snapshot.statuses_by_path.clone();\n                        let current_status_paths = statuses\n                            .entries\n                            .iter()\n                            .map(|(repo_path, _)| repo_path.clone())\n                            .collect::<BTreeSet<_>>();\n\n                        for path in &changed_paths {\n                            let mut cursor = prev_statuses.cursor::<PathProgress>(());\n                            cursor.seek_forward(&PathTarget::Path(path), Bias::Left);\n                            while let Some(entry) = cursor.item() {\n                                if !entry.repo_path.starts_with(path) {\n                                    break;\n                                }\n\n                                if !current_status_paths.contains(&entry.repo_path) {\n                                    changed_path_statuses.push(Edit::Remove(PathKey(\n                                        entry.repo_path.as_ref().clone(),\n                                    )));\n                                }\n                                cursor.next();\n                            }\n                        }\n\n                        let mut cursor = prev_statuses.cursor::<PathProgress>(());\n\n                        for (repo_path, status) in &*statuses.entries {\n                            let current_diff_stat = diff_stats.get(repo_path).copied();\n                            let current_staged_diff_stat =\n                                staged_diff_stats.get(repo_path).copied();\n                            let current_unstaged_diff_stat =\n                                unstaged_diff_stats.get(repo_path).copied();\n\n                            if cursor.seek_forward(&PathTarget::Path(repo_path), Bias::Left)\n                                && cursor.item().is_some_and(|entry| {","sourceCodeStart":10492,"sourceCodeEnd":10528,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/project/src/git_store.rs#L10492-L10528","documentation":"Zed validates the git.worktree_directory setting before creating a managed git worktree (crates/project/src/git_store.rs:10492). The value must be relative because it is joined onto the repository anchor path; absolute POSIX paths, Windows drive-letter paths, and values starting with a backslash are rejected up front (an explicit leading-slash check compensates for Windows Path::is_absolute() requiring a drive letter).","triggerScenarios":"Setting \"git\": { \"worktree_directory\": \"/tmp/worktrees\" } (or \"C:\\\\worktrees\", \"\\\\worktrees\") in settings.json, then creating a worktree. A value like \"///\" also lands here because it is absolute before trailing separators are trimmed.","commonSituations":"Users copying an absolute path they previously passed to git worktree add into settings; Windows drive-letter paths; leading-backslash values.","solutions":["Use a relative path such as \".zed-worktrees\" (resolved inside the repository)","To place worktrees next to the repository, use \"../my-repo-worktrees\"","Remove the setting entirely to fall back to the default location"],"exampleFix":"// settings.json - before\n{ \"git\": { \"worktree_directory\": \"/tmp/worktrees\" } }\n\n// settings.json - after\n{ \"git\": { \"worktree_directory\": \"../my-repo-worktrees\" } }","handlingStrategy":"validation","validationCode":"fn assert_relative_worktree_directory(setting: &str) -> Result<(), String> {\n    if setting.starts_with('/')\n        || setting.starts_with('\\\\')\n        || Path::new(setting).is_absolute()\n    {\n        return Err(format!(\"git.worktree_directory must be a relative path, got: {setting:?}\"));\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep git.worktree_directory relative; use \"../name\" for sibling locations","Validate user-supplied path settings in CI or editor linting before shipping configs"],"tags":["git","worktree","settings","configuration","path-validation"],"backgroundTag":"invalid-config-value","analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}