openai / openai/codex

[Bug] Windows Desktop app fails to start after update to v26.820.60940 ("Unable to locate Codex CLI" & spawn EINVAL on .cmd wrapper)

Open
#40,752 87 comments 52 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug windows-os
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of the Codex App are you using (From “About Codex” dialog)?

26.820.60940

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Windows 11 (x64)

What issue are you seeing?

After updating the Codex desktop app to version 26.820.60940, the application fails to launch on startup, reporting two sequential errors:

Initial launch failure:

Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.
The desktop client fails to locate its bundled internal binary in the Electron resources/bin directory.

Secondary failure when specifying wrapper script:
When setting CODEX_CLI_PATH to the standard global npm command (codex.cmd), the app fails immediately with:

spawn EINVAL
This occurs because Electron's child_process.spawn() attempts to execute the .cmd wrapper directly without { shell: true }.

Image Image
What steps can reproduce the bug?

Update Codex desktop to version 26.820.60940 on Windows 11.

Launch the application.

Observe the initial error: Unable to locate the Codex CLI binary.

Set the user environment variable CODEX_CLI_PATH to ...\nodejs\codex.cmd.

Relaunch the application.

Observe the secondary error: spawn EINVAL.

Workaround
Manually pointing CODEX_CLI_PATH directly to the underlying native executable binary bypasses both errors and successfully launches the application:

What is the expected behavior?

No response

Additional information

CODEX_CLI_PATH = <npm_root>\node_modules@openai\codex\node_modules@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\bin\codex.exe
Suggested Fixes
Ensure the Electron installer/updater bundles and extracts the native codex.exe binary into resources/bin/ by default.

If falling back to system PATH or CODEX_CLI_PATH on Windows, resolve .cmd/.bat wrappers appropriately or use { shell: true } when spawning batch files to prevent spawn EINVAL.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting how the Electron app locates resources/bin/codex and how CODEX_CLI_PATH is passed to child_process.spawn on Windows. Reproduce the update and launch flow on Windows 11, including a codex.cmd path; done means the bundled codex.exe is found by default and .cmd wrappers no longer produce spawn EINVAL.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, node.js
Domain
build-system, desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.