Windows Desktop: archiving existing local threads fails with os error 2

Open 💬 2 comments Opened Aug 20, 2026 by andrezheng-git
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Summary

On Codex Desktop for Windows, archiving valid local threads repeatedly fails with:

failed to archive session: thread-store internal error: failed to archive thread: 系统找不到指定的文件。 (os error 2)

The rollout file exists at the exact path recorded in state_5.sqlite, and %USERPROFILE%\.codex\archived_sessions also exists. Restarting Codex and archiving one thread at a time do not help.

Environment

  • Codex Desktop package: 26.814.5517.0
  • App-server client version in logs: 26.814.41957
  • Windows: 10.0.26200.9168
  • Local Windows threads; affected projects include a repository on a non-system drive
  • Thread store under %USERPROFILE%\.codex

Steps to reproduce

  1. Open Codex Desktop on Windows.
  2. Select an older local project thread.
  3. Choose Archive from the thread menu.
  4. Repeat after restarting Codex or with a single thread rather than batch archive.

Actual behavior

The thread remains unarchived. The thread/archive RPC shuts down the loaded thread and clears its listener, but then returns os error 2.

The database row remains:

archived = 0
archived_at = NULL

The recorded rollout path has the Windows extended-length prefix:

\\?\C:\Users\<user>\.codex\sessions\YYYY\MM\DD\rollout-...jsonl

Independent checks confirm:

  • the source rollout file exists and is readable;
  • the destination archive directory exists;
  • no destination file with the same name exists;
  • the same failure occurs across multiple threads and rollout sizes;
  • restarting the app does not change the result.

Representative log sequence:

thread <id> was active; shutting down
Shutting down Codex instance
Agent loop exited
clearing thread listener during thread-state teardown
failed to archive thread: The system cannot find the file specified. (os error 2)

Expected behavior

A valid rollout under the configured sessions directory should be moved to archived_sessions, and the thread row should be updated to archived = 1.

Diagnostic workaround that succeeded

After first backing up state_5.sqlite, manually moving the exact rollout to archived_sessions and updating archived, archived_at, and rollout_path made the thread disappear from the active list. A subsequent thread/archive call then returned success.

This suggests a Windows path-resolution or source-path/state mismatch inside the normal archive implementation, possibly involving the \\?\ path prefix. No conversation content or project files are included in this report.

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 8 days ago

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

  • #39600
  • #39627
  • #39471
  • #39468
  • #39492

Powered by Codex Action

SerasAM · 7 days ago

Additional reproduction on the current Windows Desktop build:

  • Codex Desktop package: 26.814.5517.0.
  • A newly created local automation thread also reproduced the failure; this is not limited to legacy threads.
  • The thread/archive request returned JSON-RPC -32603 with failed to archive session: thread-store internal error: ... (os error 2).
  • The rollout JSONL existed, was readable, and its session_meta ID matched the thread. The stored threads.rollout_path began with the Windows extended-length prefix \\?\\C:\\Users\\<redacted>\\.codex\\sessions\\....
  • With Codex fully stopped, a verified backup was made and only the leading \\?\\ prefix was removed for that one affected row. SQLite PRAGMA quick_check remained ok; the official archive operation then succeeded, moved the JSONL to archived_sessions, and preserved its SHA-256.
  • New active rows on this same build continue to be written with the extended prefix, so this workaround is not durable and the writer/archive path handling still appears to need a regression fix.

No thread IDs, user names, local project paths, transcript content, or raw logs are included.