CLI cannot resume conversations; unarchive fails and local state database is corrupted
What happened
I can no longer resume my Codex conversations from the CLI, and the Codex Desktop app shows no conversations.
For example:
Failed to resume session from ~/.codex/sessions/2026/07/24/rollout-...-019f922f-7501-7851-8f54-c7dd58b6b0bd.jsonl:
thread/resume failed during TUI bootstrap:
session 019f922f-7501-7851-8f54-c7dd58b6b0bd is archived.
Run `codex unarchive 019f922f-7501-7851-8f54-c7dd58b6b0bd` to unarchive it first.
However, running the suggested command also fails:
codex unarchive 019f922f-7501-7851-8f54-c7dd58b6b0bd
Error: failed to unarchive session
This affects multiple conversations, not just one.
Environment
- macOS 26.5.2
- Apple Silicon
- Codex CLI 0.145.0
- Standalone Codex installation
- ChatGPT login
- I restarted the computer before testing again
What I checked
The affected JSONL session files are still present on disk, so this does not look like normal data deletion.
Running codex doctor reports:
state database integrity check failed
rollout DB archive mismatches: 1
rollout DB duplicate DB paths: 3
rollout DB stale rows: 5
rollout DB missing active rows: 7
logs_2.sqlite: database disk image is malformed
Running SQLite integrity checks on ~/.codex/state_5.sqlite reports B-tree/index corruption, including:
Tree 5 page 5 right child: Rowid 315 out of order
wrong # of entries in index ...
row ... missing from index ...
I also found that the same session ID can produce inconsistent results depending on how the database is read: one lookup says it is archived and points to an unrelated archived rollout, while a table scan points to the actual session JSONL under the normal sessions directory.
Expected behavior
- Existing conversations should remain resumable after restarting Codex.
codex unarchive <session-id>should work for a session that is marked archived.- The Desktop app should not appear empty when the session files are still present locally.
- If local state is corrupted, Codex should report that clearly rather than presenting the conversations as missing.
Related reports
This seems related to:
- #20493 — Desktop chats disappear after update/import and local state corruption
- #21128 — Desktop hides existing local conversations
- #19362 — Archived local sessions fail to resume
- #19267 — Persisted thread/archive corruption
This report may be a duplicate of part of those issues, but the failed unarchive operation and the database integrity/cross-wiring symptoms seem worth documenting separately.
I have not attached raw transcripts, databases, global state, authentication files, or logs because they may contain private prompts, paths, tokens, or MCP configuration. I can provide complete files or additional diagnostics privately if the Codex team needs them for debugging.
1 Comment
I’m testing Codex Rescue against real broken-session cases. Since your rollout files are still present but the local state DB is corrupted, this is a useful case because Rescue works from the rollout and does not modify Codex SQLite state.
If you still have one affected session, would you be willing to try
codex-rescue doctor --latestand, if it selects the right rollout,salvage --fork/verify? Sanitized output only is enough — please don’t share raw rollout files, SQLite DBs, prompts, credentials, or private paths.https://github.com/shleder/codex-rescue