zed-industries/zed · error · anyhow::Error

cannot grant sandbox write access to `{}`: only Windows driv

Error message

cannot grant sandbox write access to `{}`: only Windows drive paths (`C:\...`) and WSL absolute paths (`/...`) are supported

What it means

Validation in windows_wsl.rs resolve_canonical_for_grant(): the write-grant path is neither a Windows drive path (C:\...) nor a WSL absolute path (/...), so the sandbox cannot resolve or bind-mount it inside WSL. Only those two path shapes are supported.

Source

Thrown at crates/sandbox/src/windows_wsl.rs:355

        ensure!(
            parse_native_drive_path(&canonical.to_string_lossy()).is_ok(),
            "cannot grant sandbox write access to `{}`: it resolves to `{}`, \
             which is not a Windows drive path",
            requested.display(),
            canonical.display()
        );
        // A Windows drive is reached inside WSL via DrvFs (weaker guarantees), so
        // a native-drive grant is on a Windows filesystem by definition.
        return Ok(ResolvedGrant {
            canonical,
            on_windows_fs: true,
        });
    }

    // Otherwise the grant must be a Linux-absolute WSL path, which only WSL can
    // canonicalize. `\\wsl.localhost\...` and other shapes are rejected.
    let wsl_path = parse_wsl_absolute_path(&path_string).map_err(|_| {
        anyhow::anyhow!(
            "cannot grant sandbox write access to `{}`: only Windows drive paths \
             (`C:\\...`) and WSL absolute paths (`/...`) are supported",
            requested.display()
        )
    })?;
    let mapping = PathMapping::Wsl(wsl_path);

    let wsl_exe = wsl_exe_path();
    if !wsl_exe.is_file() {
        return Err(unavailable(format!(
            "WSL (`wsl.exe`) was not found at `{}`",
            wsl_exe.display()
        )));
    }

    // Translate + existence-check the path inside WSL, then resolve its
    // symlink-free canonical (and classify its filesystem) via the helper. No
    // distro is pinned — a sandboxed command runs in one distro.

View on GitHub (pinned to f4178619ac)

Solutions

  1. Grant write access only to Windows drive paths or WSL absolute paths
  2. Move the working directory to a supported path
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/sandbox/src/windows_wsl.rs:355 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/249f93d756783d32. Report an issue: GitHub.