Repository navigation
Description
What version of the Codex App are you using (From “About Codex” dialog)?
Windows Codex Desktop fails to start: "Unable to locate the Codex CLI binary" even though codex.exe is installed and accessible
What subscription do you have?
After launching the Codex Desktop application, it immediately fails with: "ChatGPT failed to start. Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex."
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
Title:
I encountered the same issue: Windows Codex Desktop fails to start with "Unable to locate the Codex CLI binary"
Description:
I encountered the same issue on Windows and would like to provide additional diagnostic information and a workaround.
After launching Codex Desktop, the application fails immediately with:
"ChatGPT failed to start.
Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex."
Environment:
- OS: Windows 11 x64
- Application package: OpenAI.Codex
- Version: 26.820.7780.0
Investigation:
I verified that the Codex CLI installation itself is working correctly.
Standalone Codex CLI path:
C:\Users\lenovo\AppData\Local\Programs\OpenAI\Codex\bin\codex.exe
Running:
codex --version
returns:
codex-cli 0.149.1
I configured the environment variable:
CODEX_CLI_PATH
with:
C:\Users\lenovo\AppData\Local\Programs\OpenAI\Codex\bin\codex.exe
The environment variable is correctly stored and the executable can be launched successfully.
Additional findings:
The installed Windows package contains:
app\resources\codex.exe
but does not contain:
app\resources\bin\codex
The application error message suggests it expects:
resources/bin/codex
but the installed package appears to provide:
resources/codex.exe
I also tested the bundled executable:
app\resources\codex.exe
but executing it directly results in:
ResourceUnavailable
NativeCommandFailed
Access denied
Workaround:
The issue can be temporarily bypassed by installing the standalone Codex CLI and setting:
CODEX_CLI_PATH
to the native executable:
C:\Users\lenovo\AppData\Local\Programs\OpenAI\Codex\bin\codex.exe
After restarting the Windows session and launching Codex Desktop again, the application can locate the CLI successfully.
Expected behavior:
Codex Desktop should either:
- Correctly locate the bundled CLI binary automatically.
or
- Correctly respect CODEX_CLI_PATH during startup.
Possible root cause:
The Windows Electron/MSIX package or startup logic may have a mismatch between the expected CLI location:
resources/bin/codex
and the actual packaged file:
resources/codex.exe
Suggested fixes:
- Ensure the Windows package includes the expected resources/bin/codex binary.
- Fix the startup path resolution logic.
- Ensure CODEX_CLI_PATH is consistently respected on Windows.
- Provide a clearer error message or repair guidance when the bundled binary cannot be executed.
Thank you for investigating this Windows issue.
What steps can reproduce the bug?
Possible root cause:
The Windows Electron/MSIX package or startup logic may have a mismatch between the expected CLI location:
resources/bin/codex
and the actual packaged file:
resources/codex.exe
Suggested fixes:
- Ensure the Windows package includes the expected resources/bin/codex binary.
- Fix the startup path resolution logic.
- Ensure CODEX_CLI_PATH is consistently respected on Windows.
- Provide a clearer error message or repair guidance when the bundled binary cannot be executed.
Thank you for investigating this Windows issue.
What is the expected behavior?
Expected behavior:
Codex Desktop should either:
- Correctly locate the bundled CLI binary automatically.
or
- Correctly respect CODEX_CLI_PATH during startup.
Additional information
No response
Activity
github-actions commentedon Aug 26, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
selfrestart commentedon Aug 27, 2026
I hit the exact same issue and want to add a second confirmed data point for the CODEX_CLI_PATH workaround.
Environment:
Symptoms:
D:\Node.js\node_global\node_modules@openai\codex\node_modules@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\bin\codex.exe
Workaround confirmed:
Setting the user environment variable:
CODEX_CLI_PATH=D:\Node.js\node_global\node_modules@openai\codex\node_modules@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\bin\codex.exe
then fully quitting and relaunching ChatGPT Desktop fixed the issue. So this workaround is reproducible by more than one user.
Additional observation (possible release pipeline issue):
While debugging, I also found that @openai/[email protected] on npm initially declared npm:@openai/[email protected] in its optionalDependencies, but that version was missing from the registry (404) — the win32-x64 dist-tag only pointed to 0.150.0-win32-x64. It was published shortly after, and reinstalling (npm install -g @openai/codex@latest --include=optional) then installed the native binary correctly. Worth double-checking that platform packages always ship together with the main package.
The bundled-binary relocation bug still needs a proper fix, but this workaround is solid in the meantime. Thanks for the report!
Andu180 commentedon Sep 6, 2026
Update: reproduced again on a newer Windows Codex Desktop build, but this time the failure had a second stage beyond
CODEX_CLI_PATH.Environment
OpenAI.Codex 26.901.5280.0OkInitial state
The desktop app would not create a visible window. Several
ChatGPT.exeprocesses were running and responsive, but every process had:CODEX_CLI_PATHwas already set to the current in-package CLI:A relocated per-user CLI also existed at:
So the problem was no longer simply “CLI missing”.
Key finding:
cua_noderuntime never finalizedUnder:
I found multiple staging directories for the same new runtime content ID:
but there was no finalized:
An older finalized runtime (
426e88130fe66c7e) was still present.This strongly matched the recent Windows
cua_nodestaging/finalization failures reported in #42484 and the protected-file /node_repl.exerelocation failures in #41540.Recovery that worked
With Codex/ChatGPT fully stopped:
.staging-440c4f095d41ea30-*directories.using
xcopy /Gso protected MSIX files could be written to a decrypted destination:were present and
node.exe --versionran successfully.5. Relaunched Codex Desktop.
After that, the desktop UI opened normally again.
Conclusion
On
26.901.5280.0, settingCODEX_CLI_PATHalone was not sufficient on this machine. The app could still remain headless because the newcua_noderuntime repeatedly materialized into.staging-*directories but never finalized to its content-addressed directory.This appears to be part of the same Windows MSIX/Application Protected runtime-relocation family as #41540 / #42484, rather than only the original CLI path-resolution bug in this issue.
I did not modify ownership/ACLs under
WindowsApps. The successful recovery only rebuilt the per-user runtime cache under%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node.Andu180 commentedon Sep 8, 2026
Update: issue reproduced again on 26.901.6511.0 and recovered by rebuilding the new
cua_noderuntimeThe same Windows Desktop startup failure reproduced again after another Microsoft Store update.
Environment on this recurrence:
26.901.6511.0C:\Program Files\WindowsApps\OpenAI.Codex_26.901.6511.0_x64__2p2nqsd0c76g0CODEX_CLI_PATHwas updated to the current in-package binary:...\app\resources\codex.exeObserved runtime state:
cua_nodecontent ID:b474a88d5d105afa.staging-b474a88d5d105afa-a87obA.staging-b474a88d5d105afa-EldW7e.staging-b474a88d5d105afa-TrJ6T5b474a88d5d105afaruntime directory did not exist while the app was failing to open.Recovery steps that worked:
ChatGPT.exe/Codex.exe..staging-<hash>-*directory and extract the current runtime hash automatically instead of hard-coding the previous hash.app\resources\cua_nodeinto:
%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node\b474a88d5d105afausing
xcopy /E /I /H /Y /G.The full copy looked stalled because
/Qsuppresses file output, but it was actually progressing normally. During the copy, the destination increased from roughly 1,532 to 1,907 files in ~23 seconds, and the packaged runtime contained about 4,683 files total. After the copy completed, the desktop app opened successfully again.This recurrence is important because it shows the workaround is not durable across Store updates: the runtime content hash changes, so a previously repaired runtime (for example the earlier
440c4f095d41ea30) does not prevent a later build from failing on a new hash (b474a88d5d105afa).So there appear to be two separate update-sensitive layers on Windows:
CODEX_CLI_PATHmay need to track the current versioned MSIX package path.cua_nodematerialization/finalization may fail again for each new runtime content ID.A durable product fix should make both the CLI resolution and bundled runtime relocation independent of versioned package paths / per-update manual repair, and should provide visible progress or bounded retries while the ~4.6k-file runtime is being materialized.
240409949 commentedon Oct 26, 2026
Additional Windows data point: removing a stale
CODEX_CLI_PATHoverride restored startup on Microsoft Store Codex Desktop 26.1021.3705.0.After an automatic update, the user-level variable still pointed to the previous package version, 26.1013.4894.0. That executable no longer existed, while the current package's
app\resources\codex.exedid exist. The app displayed "Unable to load organization settings."Updating the override to the current package path restored startup, but this workaround had to be repeated after updates.
I then removed the user-level variable:
After rebooting Windows, Codex started normally. The variable was confirmed absent from User, Machine, and Process scopes. No runtime cache rebuild was performed.
Startup without the override is now confirmed on this machine; behavior after the next automatic update has not yet been verified. The original source of the override is unknown.
Showing the selected CLI path and underlying launch error would help distinguish this case from actual organization-policy or network failures.