Windows Desktop WSL app-server fails to launch due to CRLF/LF SQLx migration checksum mismatch
What version of the Codex App are you using (From “About Codex” dialog)?
26.519.2081.0
What subscription do you have?
Pro
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
Upgraded Codex Desktop from Windows Store (with Codex Desktop app closed), fails to launch.
Codex CLI (not desktop app) says:
Root Cause
Your state_5.sqlite was initialized/migrated with CRLF SQL migration bytes. The updated Desktop app is launching a WSL/Linux Codex app-server
whose embedded migrations use LF bytes. SQLx migration checksums are byte-for-byte, so it treats the same SQL text with different line endings as
“migration modified.”
Evidence:
- Your DB _sqlx_migrations rows 1..31 all match sha384(CRLF(upstream migration SQL)).
- The upstream rust-v0.131.0 migration files hash differently as LF.
- Local Windows binaries embed CRLF migration text.
- Local Linux/WSL binaries embed LF migration text.
- Desktop logs show the failing app launches:
C:\Users\xxx\.codex\bin\wsl\7945a00f33bdc140\codex
- That WSL binary is codex-cli 0.131.0, and it rejects the CRLF-checksummed DB at migration 1.
Why It Started Now
Upstream commit 53a36fc1c changed app-server startup to hard-fail if the state DB cannot be opened. So this mismatch became a launch-blocking
error instead of a softer degraded state.
Relevant upstream links:
- Migration source: https://github.com/openai/codex/blob/rust-v0.131.0/codex-rs/state/migrations/0001_threads.sql
- Migrator definition: https://github.com/openai/codex/blob/rust-v0.131.0/codex-rs/state/src/migrations.rs
- Fail-closed startup change: https://github.com/openai/codex/commit/53a36fc1c20ac8b6cc26afd71cc2c1989d80cd8b
- Recovery UX change: https://github.com/openai/codex/commit/3a23e87e203a0cebb57ee1aebf654b460c1e4e1d
Recovery Implication
This is not DB corruption. It is a cross-platform migration checksum bug caused by line endings.
Now that we know all 31 checksums are CRLF-vs-LF only, a controlled repair path exists: update _sqlx_migrations.checksum from CRLF hashes to LF
hashes for versions 1..31, after backup. That is still a DB edit, but it is much less scary now because the SQL content is semantically identical;
only line endings differ. I would only do it against the live DB after testing the exact update on a copied backup and proving the updated copy
opens with the failing WSL binary.
<img width="1104" height="624" alt="Image" src="https://github.com/user-attachments/assets/c633acc4-abf8-4c66-abb4-5e3a20767178" />
What steps can reproduce the bug?
Update Codex from Windows store, try to launch Codex
What is the expected behavior?
Codex updates and then launches new version without issue or error message at launch
Additional information
_No response_
11 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Follow-up after controlled recovery testing on a copied database and then live recovery:
Confirmed root cause remains CRLF/LF migration checksum mismatch, not database corruption or a lock.
Additional findings:
state_5.sqlitewas not the only affected SQLx-managed DB.logs_2.sqlitealso had_sqlx_migrations.checksumvalues matching CRLF-normalized migration SQL, while the WSL/Linux app-server expected LF-normalized migration SQL.state_5.sqliterows1..31matched CRLF hashes of the upstream state migrations. After converting those checksum blobs to the LF hashes, the WSL app-server progressed far enough to apply the next state migration (0032_threads_preview) and then failed onlogs_2.sqlitefor the same reason.logs_2.sqliterows1..2matched CRLF hashes of the upstream logs migrations. After converting those checksum blobs to LF hashes too, the WSL app-server smoke test no longer hit the migration error and Codex Desktop launched successfully.Validation performed before/after repair:
pragma integrity_checkstayedok.migration 1 was previously applied but has been modified.Important compatibility note:
This repair makes the DB compatible with the WSL/Linux app-server path. Windows-native Codex binaries still appear to embed CRLF migration bytes and may reject the LF-repaired DB unless the product normalizes migration line endings or accepts both historical checksum forms. For affected users, do not blindly edit SQLite state; take a full backup first and test on a copy.
Suggested product-side fix:
Normalize SQL migration bytes before SQLx checksum calculation across platforms, or add a one-time compatibility path for existing databases whose migration checksums equal the CRLF form of the exact same migration SQL.
Facing the same issue here
I got it resolved, use Codex CLI standalone (I use it in WSL) and just give it the full issue and my follow up comment and it should be able to fix it, it's working now
@MisterRound — your CRLF/LF root cause is more precise than the "OpenAI modified the migration SQL in place" theory in my parallel write-up at #23787. I can confirm it from independent evidence: I extracted all 34 SHA-384 anchors directly from my own
0.131.0-alpha.9WSL backend ELF (%USERPROFILE%\.codex\bin\wsl\<hash>\codex) by scanning the binary for(sql, sha384(sql))byte-adjacency anchors, and every single one matchessha384(LF(<upstream rust-v0.131.0 migration SQL>))byte-for-byte. Anyone with the same backend version can reproduce:python codex-repair.py extract-checksums --jsonand diff against the source migrations.Two complementary observations that may be worth tracking alongside your CRLF/LF finding:
state_5.sqlite.backfill_state.status='complete', while the backend's own backfill lease is 900 s (per #11377). On any install with > ~100 MB of session history (mine: 3.5 GB across 365 sessions), the WSL backend readssessions/*.jsonlvia 9P over/mnt/c/— 5–10× slower than native ext4 — and routinely exceeds 30 s. The error you'd hit next istimed out waiting for state db backfill at ... after 30s (status: running). Full repro + manual-backfill workaround in #23787.PRAGMA table_info(<table>)on the live DB, confirm every expected column already exists, and only thenUPDATE _sqlx_migrations SET checksum = ?. That avoids the failure mode where someone naively rewrites a checksum on a DB whose schema is actually older than the binary expects.---
Reusable recovery toolkit
For anyone landing here from search, I've packaged both fixes (plus the schema-verify guardrail) into a standalone Apache-2.0 Python toolkit: https://github.com/xdifu/codex-repair
Windows PowerShell / Windows Terminal:
If you run it from WSL bash to repair Windows Codex Desktop data, pass
--codex-home "/mnt/c/Users/<WindowsUser>/.codex"so it does not target WSL's own~/.codex.What it does for you, automatically:
%USERPROFILE%\.codex\bin\wsl\*\codex(no hard-coded version constants — works for any future Codex Desktop binary).(sql, sha384(sql))byte-adjacency anchors. Means it'll keep working when OpenAI ships0.132,0.133, etc., even if those binaries embed yet another checksum set._sqlx_migrationsin bothstate_5.sqliteandlogs_2.sqlite.PRAGMA table_info(<table>)before any write — refuses to rewrite a checksum if the live schema is actually older than the binary expects..bak-fix-checksums-YYYYMMDDHHMMSS) before any mutation.--use-isolated-copymode that operates on temp copies of the DBs — safe to run for diagnosis even while Codex Desktop is still open.manual-backfillsubcommand that parsessessions/**/*.jsonlfirst-linesession_metaheaders, inserts thethreadsrows the backend would have inserted, and marksbackfill_state.status='complete'— bypassing the 30 s GUI cap entirely.Conversation history (
~/.codex/sessions/*.jsonl) is read-only the whole time. The toolkit only ever writes to the two SQLite metadata DBs, and always with backup + transaction.Cross-linking #23787 here so users hitting either symptom find both perspectives.
---
Suggested upstream fix (echoing yours): normalize SQL migration bytes before
sqlx::migrate!()hashes them —include_str!(...).replace("\r\n", "\n")at compile time, or abuild.rsstep that rewrites.sqlfiles to canonical LF form before compilation. That single change prevents every future CRLF/LF drift on every platform without any client-side shim. As a one-shot compatibility patch, the migrator'sVersionMismatcharm could also trysha384(CRLF(SQL))before failing — that would clear every existing affected install in the wild without anyone having to install a third-party tool.Adding an independent data point with the opposite drift direction.
Same release as this issue and #23787 — Codex Desktop 26.519.2081.0 (May 20 build). The release bundle ships both line-ending variants side by side:
app\resources\codex.exe(Windows-native, 238MB) — embedded migration SQL uses CRLFapp\resources\codex(Linux ELF for the WSL backend, 221MB) — embedded migration SQL uses LFVerified by mmap inspection of both binaries (
b'CREATE TABLE threads'snippet: 6 CRLF in the.exe, 0 CRLF in the ELF).My install hits the inverse of @MisterRound and @xdifu's direction:
_sqlx_migrationsrows held checksums equal toSHA-384(LF(<new SQL>))— LF-side from a prior binary.state_5.sqlite+ 2logs_2.sqlitechecksums from LF to CRLF (SHA-384(<exact CRLF bytes in resources\codex.exe>)). After patch, Codex launched cleanly and the new0032_threads_previewmigration applied forward.So the affected population splits along which backend Codex Desktop actually invokes on each user's machine (WSL ELF vs Windows-native .exe), and the same release bundle is internally inconsistent in line endings between those two binaries. Whatever upstream fix lands needs to be symmetric — both directions are reachable from a single release. xdifu's
codex-repairtoolkit covers the WSL-backend direction; the Windows-native direction's mapping is the inverse of the table @MisterRound posted above. Happy to share the per-migration LF→CRLF table if useful.Same issue
I have the same issue. In the previous version, the agent's operating environment was in WSL. After the upgrade, this problem occurred. Then, after I tried multiple times, the data was lost. The update of this version is disappointing.
I left feedback in the app and here's the feedback id for any openai employees looking here
no-active-thread-019e5bd6-3995-7302-8448-b1fec39d1b92Follow-up triage note from the same Windows Desktop + WSL update incident.
This issue remains a distinct and real startup failure: the SQLx migration checksum mismatch blocked launch before any thread recovery could happen. After that was recovered locally, a separate failure surfaced when resuming the previous long-running
/goalthread: the rollout had grown to multi-GB size and Desktop/app-server became unavailable during resume/goal recovery.I opened that separate root-cause issue as #25215 so this issue can stay focused on the update/startup database compatibility problem.
Relationship between the issues:
/goalcan grow a rollout beyond practical Desktop resume/recovery limits.All local paths/usernames remain redacted in the public reports.
Closing as a duplicate of #23251.