Skip to content

Windows Codex cannot start when WSL mode is enabled (terminalShell=wsl) #14461

Open

Description

@askxue

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

26.309.3504.0

What subscription do you have?

plus

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Codex fails to start when the following configuration exists in: C:\Users<user>.codex\codex-global-state.json

"runCodexInWindowsSubsystemForLinux": true,
"integratedTerminalShell": "wsl"

When these options are enabled, Codex desktop cannot start successfully.

The application crashes during initialization.

Image

Manually editing the configuration file resolves the issue.

File: C:\Users<user>.codex\codex-global-state.json

"runCodexInWindowsSubsystemForLinux": false,
"integratedTerminalShell": "powershell"

After this change, Codex starts normally.

What steps can reproduce the bug?

  1. Install Windows Codex
  2. Open Settings
  3. Change the Agent environment to WSL
  4. Change the Integrated terminal shell to WSL
  5. Restart

You can see the Codex crashed!

What is the expected behavior?

Works well with WSL on Windows

Additional information

Happy to help test fixes if needed.

Activity

  1. added
    app
    on Mar 12, 2026
  2. added
    bug
    windows-os
    on Mar 12, 2026
  3. wbdb commented on Mar 12, 2026

    @wbdb

    The error suggests that /usr/bin/bash is missing in your current environment. You can easily verify if it exists by running ls -l /usr/bin/bash or which bash inside your WSL terminal. Are you currently using Ubuntu as your default WSL distribution, or a minimal one like Alpine?

  4. askxue commented on Mar 13, 2026

    @askxue
    Author

    The error suggests that /usr/bin/bash is missing in your current environment. You can easily verify if it exists by running ls -l /usr/bin/bash or which bash inside your WSL terminal. Are you currently using Ubuntu as your default WSL distribution, or a minimal one like Alpine?

    Thanks for the reply.

    My WSL environment itself is working normally. Before Codex for Windows was released, WSL was actually my main development environment, and I used Codex CLI there regularly without any issues.

    The problem only appears with the Codex Windows desktop app when both of these settings are enabled:

    runCodexInWindowsSubsystemForLinux = true
    integratedTerminalShell = "wsl"

    My normal WSL development workflow (Node, pnpm, etc.) works fine outside of Codex.

  5. ralphtrickey commented on Mar 13, 2026

    @ralphtrickey

    I had that problem and found out my default wsl was docker desktop. I changed it to Ubuntu and was able to run Codex.

  6. askxue commented on Mar 14, 2026

    @askxue
    Author

    I had that problem and found out my default wsl was docker desktop. I changed it to Ubuntu and was able to run Codex.

    Thanks for the suggestion — that was exactly the issue.

    My default WSL distro was docker-desktop. After switching the default distro to my actual development environment (aimuo, which is Ubuntu), Codex now starts correctly with WSL mode enabled.

    So it seems Codex currently relies on the default WSL distro when launching.

    ➜ ~ wsl -l -v
      NAME              STATE           VERSION
    * docker-desktop    Stopped         2
      aimuo             Running         2
    ➜ ~ wsl --set-default aimuo
    操作成功完成。
    ➜ ~ wsl -l -v
      NAME              STATE           VERSION
    * aimuo             Running         2
      docker-desktop    Stopped         2
    Image
  7. rainx0r commented on Mar 19, 2026

    @rainx0r

    I'm also getting this issue but the issue for me is not WSL defaulting to Docker Desktop, it's that my WSL distro (NixOS) actually doesn't have bash at the system level, only zsh.

    It would be great if Codex on Windows through WSL could work with any bash-compatible shell.

  8. Saunak626 commented on Mar 31, 2026

    @Saunak626

    Same bug: there is only one WSL system, and setting it as default still fails to start.
    Currently, as long as "runCodexInWindowsSubsystemForLinux": true, the Codex app cannot be launched at all. Since the app won’t start, I can only access it by modifying the JSON file.

    The fundamental bug is that the Codex Windows app cannot be configured to run the agent in WSL2.

  9. squarepots commented on Apr 12, 2026

    @squarepots

    same

  10. Agwstin commented on Apr 16, 2026

    @Agwstin

    Another confirmed reproduction on the Windows desktop app with a newer Store build.

    Environment:

    • Codex app package path observed from the running process:
      C:\Program Files\WindowsApps\OpenAI.Codex_26.415.1938.0_x64__2p2nqsd0c76g0\app\Codex.exe
    • OS:
      Windows 10 Pro 25H2, build 26200.8246, x64

    User-visible error popup:

    • An error has occurred
    • Codex crashed with the following error:
    • (code=4294967295, signal=null)
    • Most recent error: None

    What makes this look like the same root cause as #14461:

    1. The persisted desktop state still has WSL enabled:
    • ~/.codex/.codex-global-state.json
    • "runCodexInWindowsSubsystemForLinux": true
    • "integratedTerminalShell": "wsl"
    1. The desktop app log shows the app-server being launched via WSL, not a native Windows transport:
    • package-local log path:
      C:\Users\agust\AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\Codex\Logs\2026\04\16\...
    • representative lines:
      • stdio_transport_spawned argsCount=2 executablePath=C:\Users\agust\.codex\bin\wsl\codex pid=25392 spawnCommand=wsl.exe
      • then repeated parse failures because the app receives non-JSON UTF-16 WSL error text on stdio
    1. The actual text being parsed is a WSL error, not MCP JSON. Log excerpts:
    • Failed to parse MCP message ... Unexpected token 'N' ... is not valid JSON
    • line preview begins with UTF-16 Spanish text:
      N\u0000o\u0000 \u0000s\u0000e\u0000 \u0000p\u0000u\u0000d\u0000o\u0000 ...
    • another line preview contains:
      Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_PATH_NOT_FOUND
    1. After that, the app-server closes with the same generic crash signature shown in the popup:
    • app_server_connection.closed code=4294967295 ... signal=null
    • Codex CLI process exited classifiedAsExpected=false code=4294967295 ... signal=null

    This strongly suggests the desktop app is still entering the WSL startup path and then failing before the initialize handshake, with the UI surfacing only the generic 4294967295 / signal=null wrapper error.

    In this repro, changing ~/.codex/config.toml sandbox settings did not change the crash behavior, which further points to persisted desktop WSL mode as the real trigger.

    If useful, I can provide a larger sanitized excerpt from the package-local desktop log, but the key evidence above seems enough to tie this to the same WSL-enabled startup path discussed in this issue.

    Edit:
    Workaround confirmed

    • App build (26.415.1938.0)
    • Changed persisted flags:
      • runCodexInWindowsSubsystemForLinux=false
      • integratedTerminalShell="powershell"
    • Result: app starts normally after full restart
    • Note: workaround only; root cause still appears to be WSL startup path
  11. AxENSRennes commented on May 19, 2026

    @AxENSRennes

    Same issue here on Windows. Since WSL is the main reason I want to use the desktop app, this makes the app pretty hard to use reliably. Would really appreciate a fix.

  12. added
    terminal
    on Jun 22, 2026
  13. yidianyiko commented on Sep 13, 2026

    @yidianyiko

    Sharing a related WSL failure and a verified fix, in case it helps others finding this issue. Our symptom differs from the original report: the desktop app opened normally, but creating a task in WSL agent mode failed.

    Environment:

    • Windows Codex desktop app 26.908.4834.0 (version observed in the installed package path in logs).
    • WSL2, with Ubuntu-24.04 already the default distribution.
    • Both WSL agent mode and the integrated WSL terminal enabled.

    The desktop log showed thread/start failing with:

    Invalid request: AbsolutePathBuf deserialized without a base path
    

    What we found: the Windows user environment variable CODEX_CLI_PATH was explicitly pointing to a Windows executable:

    C:\Users\<user>\AppData\Local\OpenAI\Codex\bin\<build-id>\codex.exe
    

    Inspection of the running WSL process showed that it was actually executing this Windows codex.exe through WSL interop as the app-server. The app's bundled startup code also prioritized this environment override when selecting the WSL executable. The package contained a Linux ELF backend, but the override selected the Windows executable instead. This explains the platform/path mismatch when starting a task for a Linux project directory.

    Fix confirmed on our machine: back up the existing override, remove it from the Windows user environment, fully exit Codex, and reopen it from the Windows Start menu. In PowerShell:

    # Inspect and save the existing value before removing it.
    [Environment]::GetEnvironmentVariable("CODEX_CLI_PATH", "User")
    
    # If it is an unwanted override pointing to Windows codex.exe:
    [Environment]::SetEnvironmentVariable("CODEX_CLI_PATH", $null, "User")

    After a full restart, creating and running a task in WSL worked normally. We kept both settings enabled:

    [desktop]
    runCodexInWindowsSubsystemForLinux = true
    integratedTerminalShell = "wsl"

    There was no need to switch back to PowerShell or disable WSL agent mode. We do not know how the override was originally set. This is a fix for this specific environment-override scenario, not a claim that it explains all failures reported here. The task-creation error also matches the symptom described in #16815.

  14. MuriLovin commented on Nov 10, 2026

    @MuriLovin

    I ran into a similar issue today (November 10, 2026) and wanted to share what worked for me in case it helps anyone else.

    I'm running Windows 11 Pro 26H2 (build 26300.9711) with WSL2 enabled and Codex Desktop version 26.1103.7773.0.

    When I launched the app, the window would just keep flickering and reloading. It never actually reached a usable state.

    After digging through the logs, I noticed a few recurring errors:

    Hosted AppServerManager identity is not ready
    bundled_executable_relocation_failed
    errorCode=ENOENT
    failedExecutableName=bwrap
    ipc-connection-reset
    

    The bwrap error caught my attention, especially after finding the similar report in #54478.

    I eventually got the app working by switching from WSL to the native Windows environment and setting PowerShell as the integrated terminal.

    These are the settings I used in my config.toml:

    [desktop]
    runCodexInWindowsSubsystemForLinux = false
    integratedTerminalShell = "powershell"

    After making those changes and restarting the app, it launched normally. No more flickering or constant reloads.

    I haven't tested the two settings separately, so I can't say for sure which one fixed it. It does seem related to the WSL integration, though.

    I also noticed that #54478 was closed after a previous update reportedly fixed a similar issue. Since I'm still seeing this behavior on version 26.1103.7773.0, I thought it was worth documenting here.

    Hopefully this helps someone running into the same problem!

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

    appbugterminalwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions