Skip to content

Codex Desktop WSL mode reuses Windows CODEX_HOME and fails SQLite migration checksum #23913

@cidico

Description

@cidico

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

Codex App package: OpenAI.Codex_26.519.2736.0_x64__2p2nqsd0c76g0

Codex CLI versions observed:

  • Windows app-server binary: codex-cli 0.133.0-alpha.1
  • WSL app-server binary installed by the Desktop app: codex-cli 0.133.0-alpha.1
  • Separately installed WSL CLI: codex-cli 0.133.0

Feedback ID: no-active-thread-019e4bf4-3082-7dd0-b08b-05abc340d31e

What subscription do you have?

Unknown / not sure from local diagnostics.

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

WSL distro:

Ubuntu Running WSL 2

What issue are you seeing?

The Codex Desktop app on Windows fails when WSL mode is enabled. The app starts a WSL app-server binary from the Windows CODEX_HOME, then the WSL binary fails to initialize SQLite state under /mnt/c/Users/<user>/.codex with a SQLx migration checksum mismatch.

The key error from the Codex Desktop log is:

[AppServerConnection] app_server_connection.closed code=1 ...
reason="Error: failed to initialize sqlite state runtime under /mnt/c/Users/<user>/.codex: failed to initialize state runtime at /mnt/c/Users/<user>/.codex: migration 1 was previously applied but has been modified"

The same failure is reproducible by running the WSL binary that the Desktop app installed:

CODEX_HOME=/mnt/c/Users/<user>/.codex \
  /mnt/c/Users/<user>/.codex/bin/wsl/ab950535f78f78c1/codex app-server --listen ws://127.0.0.1:0

Output:

codex-cli 0.133.0-alpha.1
Error: failed to initialize sqlite state runtime under /mnt/c/Users/<user>/.codex: failed to initialize state runtime at /mnt/c/Users/<user>/.codex: migration 1 was previously applied but has been modified

However, the Windows app-server binary of the same app version can initialize successfully against the Windows CODEX_HOME:

$env:CODEX_HOME="C:\Users\<user>\.codex"
C:\Users\<user>\AppData\Local\OpenAI\Codex\bin\3f4fb8cdd344abc7\codex.exe app-server --listen ws://127.0.0.1:0

Output:

codex-cli 0.133.0-alpha.1
codex app-server (WebSockets)
  listening on: ws://127.0.0.1:<port>

I also observed that manually setting the Desktop config back to Windows mode is not persistent. After launching the Desktop app, it rewrites C:\Users\<user>\.codex\config.toml back to WSL mode:

[desktop]
runCodexInWindowsSubsystemForLinux = true
integratedTerminalShell = "wsl"

When this happens, Desktop spawns:

spawnCommand=wsl.exe
executablePath=C:\Users\<user>\.codex\bin\wsl\ab950535f78f78c1\codex

Then initialization fails with the migration mismatch above.

What steps can reproduce the bug?

  1. On Windows, install/open Codex Desktop.
  2. Log in successfully.
  3. Enable or switch the Desktop app to use WSL.
  4. The app writes/uses CODEX_HOME=C:\Users\<user>\.codex, while the WSL runtime accesses it as /mnt/c/Users/<user>/.codex.
  5. The Desktop app starts the WSL app-server via wsl.exe using the binary under C:\Users\<user>\.codex\bin\wsl\...\codex.
  6. The WSL app-server exits with:
failed to initialize sqlite state runtime under /mnt/c/Users/<user>/.codex: failed to initialize state runtime at /mnt/c/Users/<user>/.codex: migration 1 was previously applied but has been modified

Additional reproduction details from local investigation:

  • Resetting/emptying C:\Users\<user>\.codex and logging in again does not permanently fix the problem once WSL mode is selected.
  • The Windows runtime can initialize the same state successfully.
  • The WSL runtime cannot initialize the Windows .codex SQLite state through /mnt/c.
  • I have a separate WSL CLI installed which uses /home/<user>/.codex; that state has a different migration count/checksum set and is not the same as the Desktop Windows CODEX_HOME.

What is the expected behavior?

Enabling WSL mode in Codex Desktop should not make the app unusable due to SQLite migration checksum mismatches.

Expected behavior could be one of:

  • Desktop WSL mode should use a native Linux CODEX_HOME inside the distro, for example /home/<user>/.codex-desktop, instead of reusing C:\Users\<user>\.codex through /mnt/c.
  • Or Windows and WSL runtimes should use byte-identical SQLx migration definitions/checksums and be able to share state safely.
  • Or the app should detect incompatible Windows-vs-WSL SQLite state and recover or migrate automatically instead of failing startup.
  • Or the UI should not silently rewrite runCodexInWindowsSubsystemForLinux = false back to true after the user/admin manually disables it to recover.

Additional information

Relevant Desktop log path:

C:\Users\<user>\AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\Codex\Logs\2026\05\21\codex-desktop-fa7f744d-09b5-4ecd-b0b3-53e4aa671603-33972-t0-i1-190442-0.log

Relevant log excerpts:

[wsl] eligible distro list listResult="NAME              STATE           VERSION\n* Ubuntu            Running         2\n  docker-desktop    Stopped         2"

[StdioConnection] stdio_transport_spawned argsCount=2 executablePath=C:\Users\<user>\.codex\bin\wsl\ab950535f78f78c1\codex pid=47224 spawnCommand=wsl.exe

[AppServerConnection] app_server_connection.closed code=1 connectionId=1 hasReason=true reason="Error: failed to initialize sqlite state runtime under /mnt/c/Users/<user>/.codex: failed to initialize state runtime at /mnt/c/Users/<user>/.codex: migration 1 was previously applied but has been modified" signal=null transport=stdio

[AppServerConnection] Codex CLI process exited classifiedAsExpected=false code=1 connectionId=1 signal=null transport=stdio

Related issues found before filing:

This issue includes the Feedback ID above and the observation that the Windows runtime succeeds while the WSL runtime fails against the same Desktop CODEX_HOME.

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appapp-serverIssues involving app server protocol or interfacesbugSomething isn't workingwindows-osIssues related to Codex on Windows systems

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions