Skip to content

Codex Windows Store 26.519.2736.0 fails on startup: "migration 1 was previously applied but has been modified" #23923

Open

Description

@simonholm

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

26.519.2736.0

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Windows 11 x64

What issue are you seeing?

After a recent Microsoft Store auto-update, Codex no longer launches and consistently fails during SQLite state initialization.

Error:

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

Environment:

  • Codex Store version: 26.519.2736.0
  • Windows 11 x64
  • Store install path:
    C:\Program Files\WindowsApps\OpenAI.Codex_26.519.2736.0_x64__2p2nqsd0c76g0\app\Codex.exe
  • State DB:
    C:\Users\<redacted>\.codex\state_5.sqlite

Things tested:

  1. Deleted WAL/SHM files (*.sqlite-wal, *.sqlite-shm) → no effect
  2. Deleted state_5.sqlite completely → Codex recreates DB and runs all 34 migrations successfully, but next launch still fails with the same migration checksum error
  3. Verified _sqlx_migrations table → all migrations marked successful
  4. Checked for duplicate installs / secondary sqlite DBs → none found
  5. Disabled newly downloaded WSL runtime binary under:
    ~/.codex/bin/wsl/ab950535f78f78c1/
    → no effect
  6. Checked LocalAppData / Package state directories for alternate DBs → none found

Important finding:
Even a freshly recreated database fails immediately afterward with the same error. This suggests the issue is internal to the shipped application/runtime rather than user DB corruption.

Hypothesis:
Possible embedded migration mismatch or migration checksum regression (sqlx-style migration validation).

At this point it does not appear locally recoverable.

What steps can reproduce the bug?

  1. Install/update Codex Windows app from Microsoft Store to version 26.519.2736.0

  2. Launch Codex normally

  3. App fails immediately during startup with:

    migration 1 was previously applied but has been modified
    

Additional reproduction observations:

  • Deleting state_5.sqlite allows Codex to recreate the DB and run migrations successfully once
  • On the following launch, the same migration integrity error reappears
  • Issue persists even with a freshly recreated database

What is the expected behavior?

Codex should launch normally after update and initialize its SQLite state database without reporting migration checksum/integrity failures.

Deleting and recreating the local state database should result in a clean startup rather than the same recurring migration validation error.

Additional information

One potentially important detail:

A new WSL runtime binary appeared immediately before the failures started:

~/.codex/bin/wsl/ab950535f78f78c1/codex

However, disabling that runtime did not resolve the issue, suggesting the migration definitions may also be embedded in the Windows application binary itself.

Another important observation:
even after deleting state_5.sqlite, Codex successfully recreates the database and applies all 34 migrations before later failing again with the same checksum/integrity error.

That behavior suggests:

  • conflicting embedded migration definitions
  • or migration checksum validation inconsistency
    rather than ordinary sqlite corruption or stale WAL state.

Activity

  1. added
    appIssues related to the Codex desktop app
    on May 21, 2026
  2. added
    bugSomething isn't working
    windows-osIssues related to Codex on Windows systems
    sessionIssues involving session (thread) management, resuming, forking, naming, archiving
    on May 21, 2026
  3. simonholm commented on May 21, 2026

    @simonholm
    Author

    Possibly related to #23923, but in this case the issue persists even after deleting and fully recreating state_5.sqlite.

    Codex successfully reapplies all migrations to a fresh DB, then immediately fails again on the next launch with the same checksum mismatch error.

    That behavior suggests the migration definitions being validated at runtime may differ from the ones initially applied during bootstrap.

  4. xdifu commented on May 23, 2026

    @xdifu

    This is the same root-cause family as #23777 / #23787: the WSL/Linux Codex backend rejects a Windows-created SQLite DB because SQLx migration checksums differ at the CRLF-vs-LF byte level. Moving state_5.sqlite* / logs_2.sqlite* aside is a launch workaround, but it forces Codex to rebuild metadata instead of repairing the existing DBs.

    For users who want to preserve local history metadata, I published a non-destructive repair tool: https://github.com/xdifu/codex-repair

    Windows PowerShell / Windows Terminal:

    git clone https://github.com/xdifu/codex-repair.git
    cd codex-repair
    python codex-repair.py fix --apply

    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.

    It backs up the SQLite DBs, extracts the active backend's expected checksums, schema-verifies before rewriting _sqlx_migrations, and leaves ~/.codex/sessions/*.jsonl read-only.

  5. SebastianBodza commented on May 24, 2026

    @SebastianBodza

    Thanks @xdifu !

    Had a similar issue, copied over my db from windows to mac. Migration failed however with the binary approach.

    Used a small skill in claude code 😄
    https://gist.github.com/SebastianBodza/cf4dcd262c46836a8ab399c5574f7781

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

    appIssues related to the Codex desktop appbugSomething isn't workingsessionIssues involving session (thread) management, resuming, forking, naming, archivingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions