# Codex cannot restore backed-up rollout sessions because SQLite metadata is missing

Open 💬 1 comment Opened Aug 24, 2026 by Gabriel4420
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of the IDE extension are you using?

26.818.61809

What subscription do you have?

plus

Which IDE are you using?

VS Code

What platform is your computer?

Windows 11 - x64

What issue are you seeing?

I reset my local Codex workspace and restored my previous session backup by copying the original .jsonl rollout files back into:

~/.codex/sessions/YYYY/MM/DD/

The rollout files are intact and contain the original conversations, but Codex does not show those sessions in the VS Code history or in:

codex resume

What steps can reproduce the bug?

Diagnosis

I ran:

codex doctor

The relevant result is:

state.rollout_db_parity
status: warning
summary: rollout files and state DB thread inventory differ

rollout DB active files: 17
rollout DB active rows: 1
rollout DB missing active rows: 16
rollout DB malformed file names: 0
rollout DB duplicate rollout thread ids: 0
rollout DB scan errors: 0

Codex reports:

cause: rollout files are missing from the state DB
measured: 16 active, 0 archived
expected: every rollout file has a matching threads row

Both SQLite databases themselves pass integrity checks:

state DB: ~/.codex/state_5.sqlite
state DB integrity: ok

thread history DB: ~/.codex/thread_history_1.sqlite
thread history DB integrity: ok

The rollout files are also detected correctly:

active rollout files: 17 files

migrate-rollouts

Running:

codex migrate-rollouts

successfully detects the sessions as eligible.

For example:

eligible  01a03457-e216-7380-abee-82f72316547e
eligible  01a03216-a706-7893-87a6-9d9566616f6f
eligible  01a0317f-aa92-7c12-b9ae-51b644a92328
eligible  01a02b7a-7ad6-7a63-9d7d-bf63b3f6edfb
...

There are 17 eligible rollouts.

However, running:

codex migrate-rollouts --apply

fails for the restored sessions with:

failed  01a03216-a706-7893-87a6-9d9566616f6f
thread-store internal error: rollout migration failed:
thread 01a03216-a706-7893-87a6-9d9566616f6f is missing its SQLite metadata

failed  01a0317f-aa92-7c12-b9ae-51b644a92328
thread-store internal error: rollout migration failed:
thread 01a0317f-aa92-7c12-b9ae-51b644a92328 is missing its SQLite metadata

Error: one or more rollout migrations failed

The same is missing its SQLite metadata error occurs for the other orphaned rollouts.

Important detail

The .jsonl rollout files themselves are valid and readable.

When opened manually, they contain the original session data, including the conversation transcript, user input, assistant events, and other session records.

Examples of files correctly detected by codex doctor:

~/.codex/sessions/2026/08/24/rollout-2026-08-24T01-45-40-01a03216-a706-7893-87a6-9d9566616f6f.jsonl

~/.codex/sessions/2026/08/23/rollout-2026-08-23T23-00-45-01a0317f-aa92-7c12-b9ae-51b644a92328.jsonl

~/.codex/sessions/2026/08/22/rollout-2026-08-22T07-50-06-01a02917-9296-7180-90fe-59db1b57d5c1.jsonl

So the session contents do not appear to be lost or corrupted. The problem seems to be that the restored rollout files no longer have their corresponding SQLite thread metadata.

What is the expected behavior?

Expected behavior

Since codex migrate-rollouts can:

  • find the rollout files;
  • parse their thread IDs;
  • identify them as eligible;
  • read the rollout contents;

I would expect migrate-rollouts --apply to be able to reconstruct the required thread metadata and import/re-index the sessions.

Alternatively, there should be a recovery/re-index command that can recreate the necessary SQLite metadata from valid orphaned rollout files.

Actual behavior

The rollout files exist and are detected, but they cannot be restored because migration requires SQLite metadata that was lost when the local workspace/state was recreated.

This leaves valid backed-up Codex conversations effectively inaccessible from the Codex UI/CLI even though the complete rollout JSONL files are still available.

Additional information

Environment

Codex CLI: 0.149.1
Install method: npm (@openai/codex)
Platform: windows-x86_64
OS: Windows 11
Terminal: VS Code integrated terminal
Authentication: ChatGPT
CODEX_HOME: C:\Users\Usuario\.codex

codex doctor reports the Codex installation itself as consistent and the CLI as up to date.

It would be very useful to have a supported way to reconstruct/re-index SQLite thread metadata from existing rollout JSONL files so backed-up sessions can be recovered after recreating the local Codex workspace.

View original on GitHub ↗

1 Comment

github-actions[bot] contributor · 3 days ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #39853

Powered by Codex Action