Hmbown/CodeWhale · error

reviewed plugin cwd is a reparse point or non-directory

Error message

reviewed plugin cwd is a reparse point or non-directory

What it means

On Windows, bind_cwd opens the reviewed plugin's working directory without write/delete sharing and inspects its attributes. This error is thrown when the path is not a real directory or is a reparse point (symlink, junction, mount point). A reparse-point cwd could redirect the child process to an unreviewed location, so the launch is refused.

Solutions

  1. Replace the symlink/junction with the real directory path in the plugin's cwd configuration
  2. Re-review the plugin pointing at the physical directory, if the reparse point is legitimate in your environment
  3. Verify the configured cwd exists and is a plain directory (dir /a shows reparse attributes)

Example fix

// before
"cwd": "C:\\plugins\\link-to-myplugin"  // junction → reparse point
// after
"cwd": "C:\\plugins\\myplugin"  // real directory
Defensive patterns

Strategy: validation

Validate before calling

# PowerShell: check the configured cwd before launch
$p = Get-Item 'C:\plugins\myplugin' -Force
if ($p.Attributes -band [IO.FileAttributes]::ReparsePoint) { throw 'cwd is a reparse point' }
if (-not $p.PSIsContainer) { throw 'cwd is not a directory' }

Try / catch

let launch = std::process::Command::new(exe).current_dir(&cwd).spawn();
if let Err(e) = launch {
    if e.to_string().contains("reparse point or non-directory") {
        eprintln!("Resolve the cwd to a real directory (no symlinks/junctions) and retry.");
    }
}

Prevention

When it happens

Trigger: bind_cwd (called from prepare_stdio_launch) bails when metadata.is_dir() is false or FILE_ATTRIBUTE_REPARSE_POINT (0x0000_0400) is set on the cwd handle. Only occurs on Windows.

Common situations: The configured cwd is a symlink or junction created for convenience; the plugin directory was replaced by a mount or OneDrive/Dropbox placeholder; a typo made the cwd point to a file.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/4661159d77ae7f81. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/mcp.rs:1082

                .open(cwd)
                .context("open reviewed plugin cwd without following links")?;
            self.cwd_fd = Some(file);
            self.cwd = None;
        }
        #[cfg(windows)]
        {
            use std::os::windows::fs::{MetadataExt as _, OpenOptionsExt as _};
            let file = fs::OpenOptions::new()
                .read(true)
                .share_mode(0x0000_0001) // FILE_SHARE_READ only
                .custom_flags(0x0220_0000) // BACKUP_SEMANTICS | OPEN_REPARSE_POINT
                .open(cwd)
                .context("open reviewed plugin cwd without write/delete sharing")?;
            let metadata = file
                .metadata()
                .context("inspect reviewed plugin cwd handle")?;
            if !metadata.is_dir() || metadata.file_attributes() & 0x0000_0400 != 0 {
                anyhow::bail!("reviewed plugin cwd is a reparse point or non-directory");
            }
            self.opened_files.push(file);
        }
        Ok(())
    }
}

#[cfg(unix)]
fn open_reviewed_launch_file(path: &Path) -> Result<fs::File> {
    crate::plugins::manifest::open_bundle_file(path)
        .context("open reviewed launch file without following links")
}

#[cfg(windows)]
fn open_reviewed_launch_file(path: &Path) -> Result<fs::File> {
    crate::plugins::manifest::open_bundle_file(path)
        .context("open reviewed launch file without links, hard links, or write/delete sharing")
}

View on GitHub (pinned to 73e0f67d83)