Recover a Codex Desktop install that refuses to start after the 0.130 to 0.131 update
Run a read-only doctor scan to confirm whether CRLF vs LF checksum drift is the cause
Dry-run the repair against an isolated copy of the DB before applying it
Back up and patch state_5.sqlite and logs_2.sqlite without losing chat sessions
Needs Python 3.10+ and on Windows you must point the script at the WSL .codex path under /mnt/c.
This repository is a rescue toolkit for users of OpenAI's Codex Desktop app. After a recent auto-update from version 0.130 to 0.131, many users found that the app refused to start, showing dialogs like Codex cannot access its local database, migration 1 was previously applied but has been modified, or timed out waiting for state db backfill after 30s. The toolkit fixes those errors without deleting any conversation history. The README explains what is going wrong. Codex Desktop keeps its data in two SQLite files inside a hidden .codex folder in your home directory. The 0.131 update changed which backend binary the app runs, switching on Windows from a native Windows build to a Linux build that runs under WSL. The new binary has its SQL migration files stored with Linux style line endings, while the old binary used Windows style line endings, and the database stores a checksum of those files to verify nothing has been tampered with. The two checksums no longer match, even though the SQL is the same, so the app refuses to open the database. A second bug then kicks in: a 30 second timeout in the app gives up too quickly while a background job is still loading old chat sessions. The fix is a Python script called codex-repair.py, with a PowerShell wrapper called repair.ps1 for Windows users. The script has two main modes. Doctor mode is read only and inspects the database, the backend binary, and the session files, then reports what it found. Fix mode does the actual repair: it backs up the databases first, verifies the schema, replaces the stored checksums with the ones the new binary expects, and unsticks the background backfill job. Nothing happens unless you pass an apply flag, and an isolated mode runs against a temporary copy of the database for preview. The toolkit takes care to be non destructive. The author says it never touches the conversation history files under .codex/sessions, and it warns against accepting the in-app Repair Codex local data now prompt because that prompt wipes thread metadata. A typical run takes under five minutes including backups. The repo also links to the upstream Codex bug reports it is based on, includes a long root cause writeup in the docs folder, and needs Python 3.10 or newer.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.