openai/codex · error · anyhow::Error

Windows sandbox is only available on Windows

Error message

Windows sandbox is only available on Windows

What it means

Guard in the non-Windows stub module: run_windows_sandbox_capture_for_permission_profile was called on a platform other than Windows, where the elevated Windows sandbox backend simply does not exist, so it unconditionally bails.

Solutions

  1. Gate sandbox usage on cfg(windows) / runtime OS checks before invoking this API
  2. Use the platform-appropriate sandbox backend (e.g., Seatbelt on macOS, Landlock/seccomp on Linux)
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/elevated_impl.rs:308 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/0505e848dbf93a79. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/elevated_impl.rs:308

mod stub {
    use super::ElevatedSandboxProfileCaptureRequest;
    use anyhow::Result;
    use anyhow::bail;

    #[derive(Debug, Default)]
    pub struct CaptureResult {
        pub exit_code: i32,
        pub stdout: Vec<u8>,
        pub stderr: Vec<u8>,
        pub timed_out: bool,
    }

    /// Stub implementation for non-Windows targets; sandboxing only works on Windows.
    #[allow(clippy::too_many_arguments)]
    pub fn run_windows_sandbox_capture_for_permission_profile(
        _request: ElevatedSandboxProfileCaptureRequest<'_>,
    ) -> Result<CaptureResult> {
        bail!("Windows sandbox is only available on Windows")
    }
}

#[cfg(not(target_os = "windows"))]
pub use stub::run_windows_sandbox_capture_for_permission_profile;

View on GitHub (pinned to 339751715c)