codex - 💡(How to fix) Fix WSL CLI cannot share Windows Codex App CODEX_HOME: migration 1 was previously applied but has been modified

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

I also tested against a copy of the Windows .codex directory instead of the live one; the same error occurs. SQLite integrity check on the copied Windows state_5.sqlite returns ok.

Root Cause

Codex couldn't start because its local database appears to be damaged.
Technical details:
  Location: /mnt/c/Users/<windows-user>/.codex/state_5.sqlite
  Cause: failed to initialize state runtime at /mnt/c/Users/<windows-user>/.codex: migration 1 was previously applied but has been modified
Repair Codex local data now? [y/N]:

Code Example

export CODEX_HOME=/mnt/c/Users/<windows-user>/.codex

---

Codex couldn't start because its local database appears to be damaged.
Technical details:
  Location: /mnt/c/Users/<windows-user>/.codex/state_5.sqlite
  Cause: failed to initialize state runtime at /mnt/c/Users/<windows-user>/.codex: migration 1 was previously applied but has been modified
Repair Codex local data now? [y/N]:

---

C:\Users\<windows-user>\.codex

---

export CODEX_HOME=/mnt/c/Users/<windows-user>/.codex

---

codex --no-alt-screen -C /home/<wsl-user> "test"

---

migration 1 was previously applied but has been modified

---

npm install -g @openai/codex@0.131.0-alpha.9
codex --version
# codex-cli 0.131.0-alpha.9

---

PRAGMA integrity_check;
ok

---

SELECT count(*) FROM threads;
130
RAW_BUFFERClick to expand / collapse

What version of Codex is running?

  • Windows Codex App: 26.513.4821.0
  • WSL Codex CLI before alignment: 0.131.0-alpha.22
  • WSL Codex CLI after aligning to the Windows App bundled Linux runtime: 0.131.0-alpha.9
  • The Linux runtime bundled inside the Windows App package also reports: codex-cli 0.131.0-alpha.9

Platform

  • Windows: Microsoft Windows NT 10.0.26200.0
  • WSL: 2.6.3.0
  • Distro: Ubuntu-24.04
  • Ubuntu: 24.04.4 LTS
  • Kernel: 6.6.87.2-microsoft-standard-WSL2

What issue are you seeing?

The Windows + WSL documentation says WSL CLI can share config/auth/sessions with the Windows Codex App by setting:

export CODEX_HOME=/mnt/c/Users/<windows-user>/.codex

However, when WSL Codex CLI starts with CODEX_HOME pointing at the Windows App Codex home, startup fails before creating a session:

Codex couldn't start because its local database appears to be damaged.
Technical details:
  Location: /mnt/c/Users/<windows-user>/.codex/state_5.sqlite
  Cause: failed to initialize state runtime at /mnt/c/Users/<windows-user>/.codex: migration 1 was previously applied but has been modified
Repair Codex local data now? [y/N]:

I did not accept the repair prompt because this is the Windows Codex App's live state database.

Steps to reproduce

  1. Install and use the Codex Windows App.
  2. Confirm the Windows App has a Codex home at:
C:\Users\<windows-user>\.codex
  1. In WSL, set:
export CODEX_HOME=/mnt/c/Users/<windows-user>/.codex
  1. Start Codex CLI from WSL:
codex --no-alt-screen -C /home/<wsl-user> "test"
  1. Observe:
migration 1 was previously applied but has been modified
  1. Align the WSL CLI to the Linux runtime bundled with the Windows App:
npm install -g @openai/[email protected]
codex --version
# codex-cli 0.131.0-alpha.9
  1. Retry with CODEX_HOME=/mnt/c/Users/<windows-user>/.codex.

Actual result: the same migration mismatch occurs.

I also tested against a copy of the Windows .codex directory instead of the live one; the same error occurs. SQLite integrity check on the copied Windows state_5.sqlite returns ok.

Expected behavior

One of these should happen:

  1. WSL Codex CLI should be able to open the Windows App CODEX_HOME as documented, or
  2. The documentation should clarify that a Windows-created state_5.sqlite cannot be shared with the Linux/WSL runtime, or
  3. Codex should detect this as a cross-runtime migration/checksum mismatch and show a non-destructive, explicit message instead of suggesting a repair of the Windows App database.

Actual behavior

WSL Codex CLI treats the Windows App state_5.sqlite as a damaged/mismatched database and offers to repair it. This is risky because the DB belongs to the Windows Codex App and appears valid from the Windows side.

Additional notes

Windows App state DB integrity check:

PRAGMA integrity_check;
ok

Windows App thread count remained stable after the cancelled test:

SELECT count(*) FROM threads;
130

No config.toml, auth files, tokens, local project paths, or session contents are included here.

Possibly related:

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

One of these should happen:

  1. WSL Codex CLI should be able to open the Windows App CODEX_HOME as documented, or
  2. The documentation should clarify that a Windows-created state_5.sqlite cannot be shared with the Linux/WSL runtime, or
  3. Codex should detect this as a cross-runtime migration/checksum mismatch and show a non-destructive, explicit message instead of suggesting a repair of the Windows App database.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix WSL CLI cannot share Windows Codex App CODEX_HOME: migration 1 was previously applied but has been modified