Skip to content

spawn codex ENOENT on Windows — app-server.mjs missing shell: true #96

@massimotodaro

Description

@massimotodaro

Bug

All plugin commands (/codex:review, /codex:adversarial-review, /codex:rescue) fail on Windows with:

spawn codex ENOENT

Environment

  • Windows 11
  • Node.js 22.x
  • Codex CLI 0.118.0 (installed globally via npm, works fine from terminal)
  • Claude Code (latest)

Root Cause

scripts/lib/app-server.mjs line 188 spawns codex without shell: true:

this.proc = spawn("codex", ["app-server"], {
  cwd: this.cwd,
  env: this.options.env,
  stdio: ["pipe", "pipe", "pipe"]
});

On Windows, npm install -g @openai/codex creates codex.cmd (not a bare codex binary). Node's spawn without shell: true cannot resolve .cmd wrappers — only shell: true or execSync/spawnSync with shell mode can.

The fix already exists in the same codebase — scripts/lib/process.mjs line 11 correctly handles this:

shell: process.platform === "win32"

But app-server.mjs doesn't apply the same pattern.

Fix

- this.proc = spawn("codex", ["app-server"], {
-   cwd: this.cwd,
-   env: this.options.env,
-   stdio: ["pipe", "pipe", "pipe"]
- });
+ this.proc = spawn("codex", ["app-server"], {
+   cwd: this.cwd,
+   env: this.options.env,
+   stdio: ["pipe", "pipe", "pipe"],
+   shell: process.platform === "win32"
+ });

This is the only spawn("codex", ...) call in the codebase, so this one-line change fixes all commands for Windows users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions