{"record":{"id":"a01c8e5185e3e479","repo":"zed-industries/zed","slug":"git-worktree-directory-must-not-be-empty","errorCode":null,"errorMessage":"git.worktree_directory must not be empty","messagePattern":"git\\.worktree_directory must not be empty","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/project/src/git_store.rs","lineNumber":10498,"sourceCode":"    repository_anchor_path: &Path,\n    worktree_directory_setting: &str,\n    path_style: PathStyle,\n) -> Result<PathBuf> {\n    // Check the original setting before trimming, since a path like \"///\"\n    // is absolute but becomes \"\" after stripping trailing separators.\n    // Also check for leading `/` or `\\` explicitly, because on Windows\n    // `Path::is_absolute()` requires a drive letter — so `/tmp/worktrees`\n    // would slip through even though it's clearly not a relative path.\n    if path_style.is_absolute(worktree_directory_setting)\n        || worktree_directory_setting.starts_with('\\\\')\n    {\n        anyhow::bail!(\n            \"git.worktree_directory must be a relative path, got: {worktree_directory_setting:?}\"\n        );\n    }\n\n    if worktree_directory_setting.is_empty() {\n        anyhow::bail!(\"git.worktree_directory must not be empty\");\n    }\n\n    let trimmed = worktree_directory_setting.trim_end_matches(['/', '\\\\']);\n    if trimmed == \"..\" {\n        anyhow::bail!(\"git.worktree_directory must not be \\\"..\\\" (use \\\"../some-name\\\" instead)\");\n    }\n\n    let joined = path_style.join_path(repository_anchor_path, trimmed)?;\n    let resolved = if path_style.is_posix() {\n        joined\n    } else {\n        path::normalize_path(&joined)\n    };\n    let resolved = if resolved.starts_with(repository_anchor_path) {\n        resolved\n    } else if let Some(repo_dir_name) = repository_anchor_path\n        .file_name()\n        .and_then(|name| name.to_str())","sourceCodeStart":10480,"sourceCodeEnd":10516,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/project/src/git_store.rs#L10480-L10516","documentation":"The same worktree-directory validator rejects an empty value (crates/project/src/git_store.rs:10498). git.worktree_directory must be a non-empty relative path; an empty string gives Zed nothing to join onto the repository anchor and is refused before any worktree is created.","triggerScenarios":"Setting \"git\": { \"worktree_directory\": \"\" } in settings.json and creating a worktree. Note that \"///\" does not reach this check - it is caught earlier as an absolute path.","commonSituations":"Explicitly blanking the setting hoping to restore the default; settings templating that renders an empty value; user error.","solutions":["Remove the git.worktree_directory key from settings.json to get the default","Set an explicit non-empty relative path such as \".zed-worktrees\" or \"../worktrees\""],"exampleFix":"// settings.json - before\n{ \"git\": { \"worktree_directory\": \"\" } }\n\n// settings.json - after\n{ \"git\": { \"worktree_directory\": \".zed-worktrees\" } }","handlingStrategy":"validation","validationCode":"if worktree_directory_setting.is_empty() {\n    return Err(\"git.worktree_directory must not be empty\".into());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit the key entirely to use the default instead of setting an empty string","Lint settings files for empty-string values on path keys"],"tags":["git","worktree","settings","configuration","empty-value"],"backgroundTag":"invalid-config-value","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"}