{"record":{"id":"85cdc068fabe16da","repo":"zed-industries/zed","slug":"sandbox-grant-path-is-neither-a-windows-drive-p","errorCode":null,"errorMessage":"sandbox grant path {} is neither a Windows drive path (`C:\\...`) nor a WSL absolute path (`/...`)","messagePattern":"sandbox grant path (.+?) is neither a Windows drive path \\(`C:\\\\\\.\\.\\.`\\) nor a WSL absolute path \\(`/\\.\\.\\.`\\)","errorType":"validation","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/sandbox/src/util/canonical_path.rs","lineNumber":247,"sourceCode":"/// sandboxed WSL command can name — a Windows drive path (`C:\\...` or `\\\\?\\C:\\...`,\n/// on NTFS) or a Linux-absolute path (`/...`, inside the WSL distro). Everything\n/// else (notably `\\\\wsl.localhost\\...` and other UNC paths, and relative paths)\n/// is rejected, so an invalid grant shape can't be represented as a\n/// [`CanonicalPathBuf`]. `Path::is_absolute` isn't used: it would reject a\n/// perfectly valid Linux-absolute grant like `/home/me` on Windows.\n#[cfg(target_os = \"windows\")]\nfn require_windows_grant_shape(path: &Path) -> io::Result<()> {\n    let text = path.to_string_lossy();\n    // Linux-absolute (WSL): exactly one leading '/'.\n    let is_wsl = text.starts_with('/') && !text.starts_with(\"//\");\n    // Windows drive (NTFS): `X:...`, optionally behind the `\\\\?\\` verbatim prefix.\n    let drive = text.strip_prefix(r\"\\\\?\\\").unwrap_or(&text);\n    let drive = drive.as_bytes();\n    let is_windows_drive = drive.len() >= 2 && drive[0].is_ascii_alphabetic() && drive[1] == b':';\n    if is_wsl || is_windows_drive {\n        Ok(())\n    } else {\n        Err(io::Error::new(\n            io::ErrorKind::InvalidInput,\n            format!(\n                \"sandbox grant path {} is neither a Windows drive path (`C:\\\\...`) \\\n                 nor a WSL absolute path (`/...`)\",\n                path.display()\n            ),\n        ))\n    }\n}\n\nimpl PartialEq for CanonicalPathBuf {\n    /// Two values are equal when they refer to the **same filesystem object**:\n    /// the inode behind the `O_PATH` fd on Linux, the canonical path on\n    /// macOS/other — never merely equal path text where an fd is available. This\n    /// is what lets policy bookkeeping dedupe \"the same location named two\n    /// different ways\" and refuse to treat \"two different objects that happen to\n    /// share a path string\" as one.\n    fn eq(&self, other: &Self) -> bool {","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/sandbox/src/util/canonical_path.rs#L229-L265","documentation":"Windows-specific validation in require_windows_grant_shape: a WSL sandbox grant path must be either a Windows drive path (C:\\... or \\\\?\\C:\\...) or a Linux-absolute path (/...) within the WSL distro. UNC paths like \\\\wsl.localhost\\... and relative paths cannot be named by the sandboxed WSL command, so they are rejected up front.","triggerScenarios":"Thrown at crates/sandbox/src/util/canonical_path.rs:247 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a Windows drive-letter path (C:\\...) for Windows-side grants","Use a Linux-absolute path (/...) for paths inside the WSL distro","Avoid \\\\wsl.localhost or other UNC paths in sandbox configuration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}