{
  "slug": "codex-sandbox-uninstall-only-windows",
  "url": "https://insidetheloop.dev/fixes/codex-sandbox-uninstall-only-windows",
  "markdown_url": "https://insidetheloop.dev/fixes/codex-sandbox-uninstall-only-windows.md",
  "title": "Codex CLI: \"Error: `codex sandbox uninstall` is only supported on Windows\"",
  "description": "Codex CLI 0.162.0 added codex sandbox uninstall for legacy Windows sandboxes. Linux uses ephemeral bubblewrap sandboxes; macOS uses Seatbelt.",
  "tool": {
    "id": "codex",
    "name": "Codex CLI",
    "long_name": "OpenAI Codex CLI (codex)",
    "url": "https://insidetheloop.dev/tools/codex",
    "latest_version": "0.162.1"
  },
  "error": "Error: `codex sandbox uninstall` is only supported on Windows",
  "variants": [],
  "output": "Error: `codex sandbox uninstall` is only supported on Windows",
  "exit_code": 1,
  "command": "codex sandbox uninstall </dev/null",
  "versions": {
    "affected": "0.162.0 and later on Linux and macOS",
    "first_bad": "0.162.0",
    "last_good": "0.161.0",
    "fixed_in": null,
    "tested": [
      "0.161.0",
      "0.162.0",
      "0.162.1"
    ]
  },
  "cause": "Codex CLI 0.162.0 added `codex sandbox uninstall` exclusively to clean up machine-wide accounts and network rules created by the legacy Windows sandbox, and explicitly rejects the command on other platforms.",
  "fix": {
    "summary": "Do not run `codex sandbox uninstall` on Linux or macOS; use `codex sandbox <COMMAND>` or `--` if running an executable named `uninstall`.",
    "commands": [
      "# Linux and macOS require no uninstallation or reset: sandboxes are ephemeral",
      "# run commands inside the Linux sandbox directly",
      "codex sandbox <command>",
      "",
      "# if executing an external binary literally named 'uninstall', pass '--' first",
      "codex sandbox -- uninstall [args]"
    ],
    "note": "On Linux and macOS, Codex creates ephemeral sandboxes on the fly using bubblewrap and macOS Seatbelt respectively without persistent machine-wide user accounts or network rules. The `codex sandbox uninstall` command exists solely for Windows administrator cleanup of legacy sandbox accounts and network rules. To forward commands to the sandbox without CLI subcommand collision, prefix them with `--`."
  },
  "reproduction": {
    "ran_at": "2026-10-10T12:17:25Z",
    "environment": "A fresh Debian 13 VM from `bin/sandbox-run` (Node.js 24, root, online, no credentials for any service), destroyed after the run.",
    "steps": [
      {
        "label": "Before 0.162.0: treated as running a command named 'uninstall' inside the sandbox",
        "version": "0.161.0",
        "command": "codex sandbox uninstall </dev/null",
        "output": "thread 'main' (2) panicked at linux-sandbox/src/linux_run_main.rs:1598:5:\nFailed to execvp uninstall: No such file or directory (os error 2)\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace",
        "exit": 101
      },
      {
        "label": "First bad release: rejected on non-Windows platforms",
        "version": "0.162.0",
        "command": "codex sandbox uninstall </dev/null",
        "output": "Error: `codex sandbox uninstall` is only supported on Windows",
        "exit": 1
      },
      {
        "label": "Same in latest stable release 0.162.1",
        "version": "0.162.1",
        "command": "codex sandbox uninstall </dev/null",
        "output": "Error: `codex sandbox uninstall` is only supported on Windows",
        "exit": 1
      },
      {
        "label": "Fix verified: running commands directly under Linux sandbox succeeds",
        "version": "0.162.1",
        "command": "codex sandbox echo 'sandbox active' </dev/null",
        "output": "sandbox active",
        "exit": 0
      },
      {
        "label": "Fix verified: forwarding command with '--' separator succeeds",
        "version": "0.162.1",
        "command": "codex sandbox -- echo 'forwarded command' </dev/null",
        "output": "forwarded command",
        "exit": 0
      }
    ]
  },
  "why": {
    "text": "Pull request #50437 (merged 2026-10-02, shipped in 0.162.0) added `codex sandbox uninstall` to remove machine-wide legacy Windows sandbox accounts and network rules with administrator privileges. In `codex-rs/cli/src/sandbox_uninstall.rs`, `SandboxUninstallCommand::run` conditionally compiles `clean_up_legacy_windows_sandbox()` on Windows and bails with `\"`codex sandbox uninstall` is only supported on Windows\"` on all other operating systems.",
    "url": "https://github.com/openai/codex/pull/50437",
    "source": "openai/codex PR #50437"
  },
  "tool_page": "https://insidetheloop.dev/tools/codex#gotcha-codex-sandbox-uninstall-fails-on-linux",
  "related": [
    {
      "slug": "codex-exec-full-auto-removed",
      "error": "error: unexpected argument '--full-auto' found",
      "url": "https://insidetheloop.dev/fixes/codex-exec-full-auto-removed"
    },
    {
      "slug": "codex-exec-not-inside-trusted-directory",
      "error": "Not inside a trusted directory and --skip-git-repo-check was not specified.",
      "url": "https://insidetheloop.dev/fixes/codex-exec-not-inside-trusted-directory"
    }
  ],
  "sources": [
    {
      "title": "PR #50437: Add a CLI command to uninstall the legacy Windows sandbox",
      "url": "https://github.com/openai/codex/pull/50437",
      "read": "2026-10-10"
    },
    {
      "title": "Codex CLI 0.162.0 release notes",
      "url": "https://github.com/openai/codex/releases/tag/rust-v0.162.0",
      "read": "2026-10-10"
    },
    {
      "title": "Codex CLI 0.162.1 release notes",
      "url": "https://github.com/openai/codex/releases/tag/rust-v0.162.1",
      "read": "2026-10-10"
    },
    {
      "title": "codex-rs/cli/src/sandbox_uninstall.rs at rust-v0.162.0",
      "url": "https://github.com/openai/codex/blob/rust-v0.162.0/codex-rs/cli/src/sandbox_uninstall.rs",
      "read": "2026-10-10"
    },
    {
      "title": "OpenAI Codex Sandboxing Concepts",
      "url": "https://developers.openai.com/codex/concepts/sandboxing",
      "read": "2026-10-10"
    }
  ],
  "date_published": "2026-10-10T12:18:00Z",
  "date_modified": "2026-10-10T12:18:00Z",
  "verified": {
    "date": "2026-10-10",
    "versions": [
      "0.161.0",
      "0.162.0",
      "0.162.1"
    ]
  }
}
