Windows Desktop: archiving existing local threads fails with os error 2
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
- Open Codex Desktop on Windows.
- Select an older local project thread.
- Choose Archive from the thread menu.
- 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.
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Additional reproduction on the current Windows Desktop build:
thread/archiverequest returned JSON-RPC-32603withfailed to archive session: thread-store internal error: ... (os error 2).session_metaID matched the thread. The storedthreads.rollout_pathbegan with the Windows extended-length prefix\\?\\C:\\Users\\<redacted>\\.codex\\sessions\\....\\?\\prefix was removed for that one affected row. SQLitePRAGMA quick_checkremainedok; the official archive operation then succeeded, moved the JSONL toarchived_sessions, and preserved its SHA-256.No thread IDs, user names, local project paths, transcript content, or raw logs are included.