zed-industries/zed · error

Windows sandboxing via WSL can only grant existing files or

Error message

Windows sandboxing via WSL can only grant existing files or directories: {}

What it means

Raised in path_to_wsl when a path being granted to the sandboxed command exists as neither a file nor a directory (or is otherwise inaccessible). WSL sandbox grants are limited to existing filesystem entries, so the invalid grant path is rejected with this error.

Source

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

    ]);
}

fn directory_to_wsl(path: &Path) -> Result<PathMapping> {
    ensure!(
        path.is_dir(),
        "Windows sandboxing via WSL can only use an existing directory as cwd: {}",
        path.display()
    );
    map_path_to_wsl(path)
}

fn path_to_wsl(path: &Path) -> Result<PathMapping> {
    let path_string = path.to_string_lossy();
    if let Ok(path) = parse_wsl_absolute_path(&path_string) {
        return Ok(PathMapping::Wsl(path));
    }

    ensure!(
        path.is_dir() || path.is_file(),
        "Windows sandboxing via WSL can only grant existing files or directories: {}",
        path.display()
    );
    map_path_to_wsl(path)
}

fn path_to_wsl_allowing_missing(path: &Path) -> Result<PathMapping> {
    let path_string = path.to_string_lossy();
    if let Ok(path) = parse_wsl_absolute_path(&path_string) {
        return Ok(PathMapping::Wsl(path));
    }
    map_path_to_wsl(path)
}

fn map_path_to_wsl(path: &Path) -> Result<PathMapping> {
    let path_string = path.to_string_lossy();
    if let Ok(path) = parse_wsl_unc_path(&path_string) {

View on GitHub (pinned to f4178619ac)

Solutions

  1. Ensure the granted file or directory exists before requesting sandbox access
  2. Fix stale or mistyped paths in the request
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/sandbox/src/windows_wsl.rs:1433 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/69e20d0712457d01. Report an issue: GitHub.