zed-industries/zed · error · std::io::Error

sandbox grant path {} is neither a Windows drive path (`C:\.

Error message

sandbox grant path {} is neither a Windows drive path (`C:\...`) nor a WSL absolute path (`/...`)

What it means

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.

Source

Thrown at crates/sandbox/src/util/canonical_path.rs:247

/// sandboxed WSL command can name — a Windows drive path (`C:\...` or `\\?\C:\...`,
/// on NTFS) or a Linux-absolute path (`/...`, inside the WSL distro). Everything
/// else (notably `\\wsl.localhost\...` and other UNC paths, and relative paths)
/// is rejected, so an invalid grant shape can't be represented as a
/// [`CanonicalPathBuf`]. `Path::is_absolute` isn't used: it would reject a
/// perfectly valid Linux-absolute grant like `/home/me` on Windows.
#[cfg(target_os = "windows")]
fn require_windows_grant_shape(path: &Path) -> io::Result<()> {
    let text = path.to_string_lossy();
    // Linux-absolute (WSL): exactly one leading '/'.
    let is_wsl = text.starts_with('/') && !text.starts_with("//");
    // Windows drive (NTFS): `X:...`, optionally behind the `\\?\` verbatim prefix.
    let drive = text.strip_prefix(r"\\?\").unwrap_or(&text);
    let drive = drive.as_bytes();
    let is_windows_drive = drive.len() >= 2 && drive[0].is_ascii_alphabetic() && drive[1] == b':';
    if is_wsl || is_windows_drive {
        Ok(())
    } else {
        Err(io::Error::new(
            io::ErrorKind::InvalidInput,
            format!(
                "sandbox grant path {} is neither a Windows drive path (`C:\\...`) \
                 nor a WSL absolute path (`/...`)",
                path.display()
            ),
        ))
    }
}

impl PartialEq for CanonicalPathBuf {
    /// Two values are equal when they refer to the **same filesystem object**:
    /// the inode behind the `O_PATH` fd on Linux, the canonical path on
    /// macOS/other — never merely equal path text where an fd is available. This
    /// is what lets policy bookkeeping dedupe "the same location named two
    /// different ways" and refuse to treat "two different objects that happen to
    /// share a path string" as one.
    fn eq(&self, other: &Self) -> bool {

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Use a Windows drive-letter path (C:\...) for Windows-side grants
  2. Use a Linux-absolute path (/...) for paths inside the WSL distro
  3. Avoid \\wsl.localhost or other UNC paths in sandbox configuration
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/sandbox/src/util/canonical_path.rs:247 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20). Data as JSON: /api/errors/85cdc068fabe16da. Report an issue: GitHub.