Skip to content

Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex. #22423

Open

Description

@Adaozuishuai

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

Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.

What subscription do you have?

我在设置中codex app中设置了wsl可以运行 然后app打不开,一直显示出错了,重新加载也没有用

What platform is your computer?

No response

What issue are you seeing?

Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex. 可以尝试的3个解决方案都没有效果

What steps can reproduce the bug?

我的codex cli 是配置在wsl 2中的 ,然后我下载codex app在设置里面打开了wsl启动这个选项就出现了这个报错。

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    app
    on May 13, 2026
  2. added
    bug
    on May 13, 2026
  3. vcerfe commented on May 13, 2026

    @vcerfe

    the same issue I encounter

  4. benname commented on May 14, 2026

    @benname

    the same issue I encounter

  5. 1ceS1amese commented on May 15, 2026

    @1ceS1amese

    备份并重置一下codex的设置即可

  6. benname commented on May 15, 2026

    @benname

    备份并重置一下codex的设置即可

    Only way to make it work was to edit .codex-global-state.json and set runCodexInWindowsSubsystemForLinux to false

  7. 1ceS1amese commented on May 15, 2026

    @1ceS1amese
  8. thanh125643 commented on May 15, 2026

    @thanh125643

    i think this dup to this issues #22672

  9. Zhangchunqin commented on May 16, 2026

    @Zhangchunqin

    me too

  10. Adaozuishuai commented on May 20, 2026

    @Adaozuishuai
    Author

    备份并重置一下codex的设置即可

    好像还是不行我直接给config文件删除了,codex走默认的设置了,打开依旧是这个Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.报错

  11. Adaozuishuai commented on May 20, 2026

    @Adaozuishuai
    Author

    然后现在这个app bug界面我点击重新加载,会闪出1秒左右的登录界面,然后我根据指引配置CODEX_CLI_PATH在config文件中依旧如出现此bug 我通过 which codex拿到的路径如下‘/home/wangguangyi/.local/bin/codex’,我 CODEX_CLI_PATH配置就是前面我获取的路径

  12. QwQ-is-not-available commented on May 22, 2026

    @QwQ-is-not-available

    备份并重置一下codex的设置即可

    好像还是不行我直接给config文件删除了,codex走默认的设置了,打开依旧是这个Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.报错

    same
    同样情况,app里智能体环境改为wsl之后打不开app,app没装在c盘

    如果说是需要要能重新打开app页面的话,我是在c盘用户目录里的.codex/config.toml 里删掉

    runCodexInWindowsSubsystemForLinux = true
    integratedTerminalShell = "wsl"
    

    之后就能重新打开app了

  13. JunieXD commented on Jun 9, 2026

    @JunieXD

    备份并重置一下codex的设置即可

    好像还是不行我直接给config文件删除了,codex走默认的设置了,打开依旧是这个Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.报错

    same 同样情况,app里智能体环境改为wsl之后打不开app,app没装在c盘

    如果说是需要要能重新打开app页面的话,我是在c盘用户目录里的.codex/config.toml 里删掉

    runCodexInWindowsSubsystemForLinux = true
    integratedTerminalShell = "wsl"
    

    之后就能重新打开app了

    打开是能打开了,但又给切回去了,这样改本来是想用wsl的codex,目的没达到啊,都一个月了怎么还没人找到解决方案

  14. thosehow commented on Jun 9, 2026

    @thosehow

    the same issue I encounter

  15. QwQ-is-not-available commented on Jun 9, 2026

    @QwQ-is-not-available

    备份并重置一下codex的设置即可

    好像还是不行我直接给config文件删除了,codex走默认的设置了,打开依旧是这个Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.报错

    same 同样情况,app里智能体环境改为wsl之后打不开app,app没装在c盘
    如果说是需要要能重新打开app页面的话,我是在c盘用户目录里的.codex/config.toml 里删掉

    runCodexInWindowsSubsystemForLinux = true
    integratedTerminalShell = "wsl"
    

    之后就能重新打开app了

    打开是能打开了,但又给切回去了,这样改本来是想用wsl的codex,目的没达到啊,都一个月了怎么还没人找到解决方案

    记得另外一个issue里提到说把codex app安装位置调整回c盘就正常了;我是直接在wsl2里用codex cli了,感觉还行

  16. 3 remaining items

  17. hit-ws commented on Jun 13, 2026

    @hit-ws

    我也遇到了同样的问题。今天 Codex App 更新到 26.609.4994.0 后,原本正常使用的 WSL 模式无法启动。

    I have the same issue. After updating Codex App to 26.609.4994.0 today, the app fails to start in WSL mode.

    Environment / 环境:

    Windows 11
    Codex App: OpenAI.Codex_26.609.4994.0_x64__2p2nqsd0c76g0
    WSL: Ubuntu, version 2
    Agent environment: WSL
    Integrated terminal: WSL
    

    Error / 报错:

    Unable to locate the Codex CLI binary.
    Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.
    

    Diagnostics / 诊断结果:

    From PowerShell:

    wsl -e bash -c 'command -v codex || echo NOT_FOUND'

    Output:

    NOT_FOUND
    

    But login shell can find Codex:

    wsl -e bash -lc 'command -v codex; codex --version; command -v bwrap'

    Output:

    /home/hit_ws/.nvm/versions/node/v24.14.0/bin/codex
    codex-cli 0.139.0
    /usr/bin/bwrap
    

    So the Codex CLI works in WSL login shell, but the Windows Codex App cannot discover it after the update.

    Before this update, the same WSL setup worked normally. After clicking the in-app update prompt today, the app immediately started failing with this error.

    中文补充:更新前 WSL 模式一直正常,更新后立刻报错。看起来像是 Codex App 26.609 对 WSL CLI discovery 的启动方式变了,导致非登录 shell 找不到 NVM 里的 codex。

  18. BretJohnson commented on Jun 13, 2026

    @BretJohnson

    我也遇到了同样的问题。今天 Codex App 更新到 26.609.4994.0 后,原本正常使用的 WSL 模式无法启动。

    I have the same issue. After updating Codex App to 26.609.4994.0 today, the app fails to start in WSL mode.

    Environment / 环境:

    Windows 11
    Codex App: OpenAI.Codex_26.609.4994.0_x64__2p2nqsd0c76g0
    WSL: Ubuntu, version 2
    Agent environment: WSL
    Integrated terminal: WSL
    

    Error / 报错:

    Unable to locate the Codex CLI binary.
    Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.
    

    Diagnostics / 诊断结果:

    From PowerShell:

    wsl -e bash -c 'command -v codex || echo NOT_FOUND'
    Output:

    NOT_FOUND
    

    But login shell can find Codex:

    wsl -e bash -lc 'command -v codex; codex --version; command -v bwrap'
    Output:

    /home/hit_ws/.nvm/versions/node/v24.14.0/bin/codex
    codex-cli 0.139.0
    /usr/bin/bwrap
    

    So the Codex CLI works in WSL login shell, but the Windows Codex App cannot discover it after the update.

    Before this update, the same WSL setup worked normally. After clicking the in-app update prompt today, the app immediately started failing with this error.

    中文补充:更新前 WSL 模式一直正常,更新后立刻报错。看起来像是 Codex App 26.609 对 WSL CLI discovery 的启动方式变了,导致非登录 shell 找不到 NVM 里的 codex。

    I see the same thing: after updating to 26.609.41114 today, the app fails to start in WSL mode, where it was working before. Setting runCodexInWindowsSubsystemForLinux to false in .codex/config.toml allows it to start - non WSL - but that's not a workaround as I need to use WSL.

  19. Bagel-Badge commented on Jun 13, 2026

    @Bagel-Badge

    我也遇到了同样的问题。今天 Codex App 更新到 26.609.4994.0 后,原本正常使用的 WSL 模式无法启动。

    I have the same issue. After updating Codex App to 26.609.4994.0 today, the app fails to start in WSL mode.我遇到了相同的问题。今天将 Codex App 更新到 26.609.4994.0 后,该应用在 WSL 模式下无法启动。

    **Environment / 环境:**Environment / 环境:

    Windows 11
    Codex App: OpenAI.Codex_26.609.4994.0_x64__2p2nqsd0c76g0
    WSL: Ubuntu, version 2
    Agent environment: WSL
    Integrated terminal: WSL
    

    Error / 报错:

    Unable to locate the Codex CLI binary.
    Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.
    

    Diagnostics / 诊断结果:

    From PowerShell:From PowerShell:

    wsl -e bash -c 'command -v codex || echo NOT_FOUND'wsl -e bash -c 'command -v codex || echo NOT_FOUND'
    Output:
    Output:

    NOT_FOUND
    

    But login shell can find Codex:But login shell can find Codex:

    wsl -e bash -lc 'command -v codex; codex --version; command -v bwrap'wsl -e bash -lc 'command -v codex; codex --version; command -v bwrap'
    Output:
    Output:

    /home/hit_ws/.nvm/versions/node/v24.14.0/bin/codex
    codex-cli 0.139.0
    /usr/bin/bwrap
    

    So the Codex CLI works in WSL login shell, but the Windows Codex App cannot discover it after the update.因此,Codex CLI 在 WSL 登录 shell 中可以正常工作,但更新后 Windows 版 Codex App 无法发现它。

    Before this update, the same WSL setup worked normally. After clicking the in-app update prompt today, the app immediately started failing with this error.在此次更新之前,相同的 WSL 设置可以正常运行。今天点击应用内更新提示后,应用立即开始出现此错误。

    中文补充:更新前 WSL 模式一直正常,更新后立刻报错。看起来像是 Codex App 26.609 对 WSL CLI discovery 的启动方式变了,导致非登录 shell 找不到 NVM 里的 codex。

    I see the same thing: after updating to 26.609.41114 today, the app fails to start in WSL mode, where it was working before. Setting runCodexInWindowsSubsystemForLinux to false in .codex/config.toml allows it to start - non WSL - but that's not a workaround as I need to use WSL.我观察到了相同的情况:今天更新到 26.609.41114 后,该应用在之前可以正常工作的 WSL 模式下无法启动。将 .codex/config.toml 中的 runCodexInWindowsSubsystemForLinux 设置为 false 可以使其以非 WSL 模式启动,但这并非一种变通方案,因为我需要使用 WSL。

    I also encountered the same problem after the update.
    我在更新后也遇到了相同的问题。

    临时解决方法:回退 Codex App 至 2026年6月13日 之前的版本,如26.608.12217,这个仓库里面有桌面版安装包的镜像 codex-app-mirror。
    Temporary workaround: Roll back the Codex App to a version prior to June 13, 2026, such as 26.608.12217. You can find mirrors for the desktop installers in this repository: codex-app-mirror.

  20. cls1277 commented on Jun 13, 2026

    @cls1277

    我也遇到了同样的问题。今天 Codex App 更新到 26.609.4994.0 后,原本正常使用的 WSL 模式无法启动。

    I have the same issue. After updating Codex App to 26.609.4994.0 today, the app fails to start in WSL mode.

    Environment / 环境:

    Windows 11
    Codex App: OpenAI.Codex_26.609.4994.0_x64__2p2nqsd0c76g0
    WSL: Ubuntu, version 2
    Agent environment: WSL
    Integrated terminal: WSL
    

    Error / 报错:

    Unable to locate the Codex CLI binary.
    Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.
    

    Diagnostics / 诊断结果:

    From PowerShell:

    wsl -e bash -c 'command -v codex || echo NOT_FOUND'
    Output:

    NOT_FOUND
    

    But login shell can find Codex:

    wsl -e bash -lc 'command -v codex; codex --version; command -v bwrap'
    Output:

    /home/hit_ws/.nvm/versions/node/v24.14.0/bin/codex
    codex-cli 0.139.0
    /usr/bin/bwrap
    

    So the Codex CLI works in WSL login shell, but the Windows Codex App cannot discover it after the update.

    Before this update, the same WSL setup worked normally. After clicking the in-app update prompt today, the app immediately started failing with this error.

    中文补充:更新前 WSL 模式一直正常,更新后立刻报错。看起来像是 Codex App 26.609 对 WSL CLI discovery 的启动方式变了,导致非登录 shell 找不到 NVM 里的 codex。

    me too !

  21. cls1277 commented on Jun 13, 2026

    @cls1277

    Perhaps you could try this solution. #22672 (comment)

  22. xuetianhao98 commented on Jun 13, 2026

    @xuetianhao98

    Environment

    • Windows 11 with WSL2
    • The Codex workspace is located inside WSL2

    Issue and Solution

    I encountered the same issue: after Codex was updated, it failed to launch the next time I opened it.

    The solution that worked for me was to set the following environment variable in Windows:

    CODEX_CLI_PATH=C:\Users\<YOUR_USERNAME>\.codex\bin\wsl\<VERSION_OR_HASH>\codex
    

    After configuring this environment variable, Codex has been working normally.

    Important Note

    There may be a similar Codex installation under:

    C:\Users\<YOUR_USERNAME>\AppData\Local\OpenAI\Codex
    

    However, if your workspace and development environment are running inside WSL, do not use the executable from that directory. Use the WSL-specific Codex executable located under your .codex\bin\wsl directory instead.

  23. BretJohnson commented on Jun 13, 2026

    @BretJohnson

    For me, I didn't have a C:\Users\<YOUR_USERNAME>\.codex\bin\wsl directory (perhaps I used to but I had deleted contents of .codex and apparently the latest Codex app install on Windows doesn't install this).

    So I ended up going with this workaround: #22672 (comment)

  24. black-yt commented on Jun 13, 2026

    @black-yt

    更新 Codex App 后出现:

    Unable to locate the Codex CLI binary
    

    如果之前在 Codex App 里把 Agent Environment 设置成了 WSL,那么实际上系统里可能同时存在 3 个 Codex:

    1. Windows npm 安装的 Codex
    C:\Users\<user>\AppData\Roaming\npm\codex
    C:\Users\<user>\AppData\Roaming\npm\codex.cmd
    

    这是在 Windows 终端里执行 codex 用的。

    1. WSL 里自己安装的 Codex

    例如:

    /home/xwh/.nvm/versions/node/v22.22.2/bin/codex
    

    这是你在 Ubuntu/WSL 终端里执行 codex 用的。

    1. Codex App 自动生成的 WSL Wrapper(真正被 App 调用的)

    例如:

    C:\Users\<user>\.codex\bin\wsl\48731301ce01af57\codex
    

    这是 Codex App 为了桥接 Windows 和 WSL 自动生成的启动器。

    问题的根源在于:

    • 更新前,Codex App 被设置为使用 WSL 环境。
    • 很多人以为它直接调用第 2 个(WSL 里的 codex)。
    • 实际上它调用的是第 3 个(自己生成的 WSL Wrapper)。
    • 更新后 App 丢失了这个 Wrapper 的定位信息。
    • 因此启动时报:
    Unable to locate the Codex CLI binary
    

    很多人会误把环境变量设置到:

    AppData\Roaming\npm\codex
    

    或者:

    /home/.../codex
    

    结果会出现各种奇怪错误(.cmd 语法错误、node not found 等)。

    正确修复方法:

    先找到 App 自动生成的 WSL Wrapper,找到类似:

    C:\Users\<user>\.codex\bin\wsl\48731301ce01af57\codex
    

    然后设置:

    setx CODEX_CLI_PATH "C:\Users\<user>\.codex\bin\wsl\48731301ce01af57\codex"

    验证:

    echo %CODEX_CLI_PATH%

    重启 Codex App 即可恢复。

  25. thxzrp commented on Jun 14, 2026

    @thxzrp

    tive o mesmo problema após atualizar ontem. solução foi setar as variáveis de ambiente de volta ao windows.

  26. bugstan commented on Jun 14, 2026

    @bugstan

    same
    Thank you @black-yt

  27. LvJohny commented on Jun 15, 2026

    @LvJohny

    备份并重置一下codex的设置即可

    好像还是不行我直接给config文件删除了,codex走默认的设置了,打开依旧是这个Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.报错

    same 同样情况,app里智能体环境改为wsl之后打不开app,app没装在c盘
    如果说是需要要能重新打开app页面的话,我是在c盘用户目录里的.codex/config.toml 里删掉

    runCodexInWindowsSubsystemForLinux = true
    integratedTerminalShell = "wsl"
    

    之后就能重新打开app了

    打开是能打开了,但又给切回去了,这样改本来是想用wsl的codex,目的没达到啊,都一个月了怎么还没人找到解决方案

    修改回去
    runCodexInWindowsSubsystemForLinux = false
    integratedTerminalShell = "powershell"

  28. Buzzology commented on Jun 15, 2026

    @Buzzology

    Same problem

  29. pwnfan commented on Aug 26, 2026

    @pwnfan

    For the same error after updating to Windows x64 26.820.7780.0, there is now at least one regression variant unrelated to the WSL PATH or a user-installed CLI.

    In this variant, the earliest log failure is ERROR_ENCRYPTION_FAILED while copying resources\codex.exe, cua_node, and rg.exe from the protected WindowsApps/MSIX package into the per-user cache. "Unable to locate the Codex CLI binary" is only a secondary error. Deleting configuration, setting CODEX_CLI_PATH, or reinstalling the same package generally does not fix this variant.

    The current-build report and a verified no-rollback recovery are documented at #40700 (comment). The closely related WSL relocation root cause is tracked in #38696. The recovery does not change WindowsApps ACLs, ownership, or package files.

    The complete procedure is relatively involved. If the desktop app cannot start, the simplest option is to give the linked comment to a working Codex CLI on Windows or WSL, or to a ChatGPT desktop session running inside WSL. The agent should first confirm that the machine has the same failure signature, then perform the recovery and validate startup.

  30. liangjxiong commented on Aug 26, 2026

    @liangjxiong

    Additional Windows reproduction (2026-08-26): the app shows the same startup dialog, Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.

    A second failure mode was observed after manually changing the CLI/path configuration as a workaround: Codex could be made to launch, but it then lost the ability to modify project files/code. Reverting away from the path workaround leads back to the startup failure.

    This is important because a manual CODEX_CLI_PATH workaround may bind the Desktop app to the wrong runtime (Windows vs WSL) or create a working-directory/sandbox mismatch. A supported recovery path should restore both startup and file-write/edit capability without requiring users to pin CODEX_CLI_PATH to a WindowsApps binary or an incompatible Windows/WSL CLI.

    The reported screenshot text exactly matches this issue. App version / sanitized logs can be added once collected.

  31. aswordok commented on Sep 7, 2026

    @aswordok

    在任务管理器中,展开 ChatGPT 下的没有图标的那个 code.exe(带 .exe 那个),右键打开文件所在的位置,右键 codex.exe,复制文件所在的位置,
    setx CODEX_CLI_PATH "C:\Program Files\WindowsApps\OpenAI.Codex_26.901.6511.0_x64__2p2nqsd0c76g0\app\resources\codex.exe"
    或者
    powershell:
    $pkg = Get-AppxPackage OpenAI.Codex
    $codexPath = Join-Path $pkg.InstallLocation "app\resources\codex.exe"
    [Environment]::SetEnvironmentVariable(
    "CODEX_CLI_PATH",
    $codexPath,
    "User"
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions