Repository navigation
[Windows] NUL-corrupted state wipes projects and backup #38757
Description
What version of the Codex App are you using (From “About Codex” dialog)?
26.810.4967.0
What subscription do you have?
Pro
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
All existing projects disappeared from the Codex App after startup.
At 07:18:45 on 2026-08-15, Codex loaded a NUL-filled .codex-global-state.json as empty state. It then saved the replacement project registry and copied it to .bak, overwriting the recovery backup without warning.
Existing chat rows and workspace folders remained on disk, but the project list and thread-to-project mappings were gone. Creating one test project produced a registry containing only that project; none of the previous chats were reattached.
This is persistent metadata loss, not a sidebar display or cache problem.
What steps can reproduce the bug?
- Start with a Codex profile containing multiple projects and project-linked chats.
- Close Codex, leaving the thread database intact.
- Make
.codex-global-state.jsoninvalid by filling it with NUL bytes. - Launch Codex.
- Codex opens without an error and shows an empty Projects list.
- Create one test project and restart.
- Only the test project remains. Previous mappings are absent, and
.bakcontains the replacement state instead of the last known-good registry.
Observed result: the registry changed from 8 projects / 65 assignments to 1 project / 0 assignments while the thread database retained approximately 1,070 rows.
What is the expected behavior?
Codex must treat an invalid global-state file as a recovery event, not as a valid empty registry.
It must stop automatic writeback, preserve the last known-good backup, warn the user, and restore or rebuild project mappings from durable records. It must never copy unvalidated replacement state over the recovery backup.
Additional information
Evidence:
- Codex App: 26.810.4967.0
- Windows: 10.0.26200.0 x64
- Last usable snapshot: 8 projects, 65 assignments
- Current registry: 1 test project, 0 assignments
- Thread database: approximately 1,070 rows
- Failure timestamp: 2026-08-15 07:18:45 local time
- Troubleshooting began afterward at 07:19:35
- No task, prompt, project-name, or conversation content is included
GitHub flags #37212 as related. This incident additionally records NUL corruption and overwrite of the recovery backup.
Activity
github-actions commentedon Aug 15, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
local-projectswith empty state and mirror it to.bak#37927Powered by Codex Action
kovachinfo commentedon Sep 7, 2026
I experienced a similar issue on Windows on September 7, 2026.
App version: 26.901.6511.0
Codex CLI helper: 0.153.4
After reboot, the app launched successfully, but onboarding appeared again and all local projects disappeared from the sidebar. Existing chats and workspace folders remained available.
Desktop logs recorded:
“[global-state] Failed to load global state”
“Unexpected token '\u0000' ... is not valid JSON”
Shortly afterward, the logs reported:
“Local app-server project migration completed projectCount=15”
However, the sidebar still showed no local projects:
Recovery:
With the app closed, we rebuilt the JSON project list from the CURRENT SQLite records, without restoring an older snapshot or modifying SQLite. We also reconstructed 169 task assignments using unique matching workspace paths. After restarting, all 15 projects became visible again.
Separately, Windows Controlled Folder Access blocked codex-windows-sandbox-setup.exe, causing “setup refresh had errors” when executing local commands. Allowing that executable restored command execution. We have no evidence that Defender caused the global-state corruption.
The cause of the NUL bytes remains unknown. The original corrupt state was no longer available by the time diagnostics were collected.
This may help investigate why surviving SQLite projects are not restored to the sidebar after global-state corruption.
tengweid commentedon Sep 10, 2026
Urgent escalation: another Windows incident with conversation access loss and interrupted project work
Please prioritize this as a serious data-integrity and work-continuity incident. The affected user explicitly reports that this has caused serious consequences, including lost conversations and interrupted project progress/work incidents, and requests a prompt fix and a response from the Codex team.
Environment and incident window
OpenAI.Codex_26.903.8094.0_x64(version obtained from the installed package path).codex-cli 0.153.4.New evidence from this installation
.codex-global-state.jsoncontained"local-projects": {}, with no thread assignment map, while the SQLite project records and many existing thread rows/associations still existed.projectsMigrated: trueandthreadAssignmentsMigrated: false.config.toml.corrupted.bakwas inspected as bytes, without exposing its contents:Impact and limits of the diagnosis
Requested action
Please:
Potentially related: #26421 (NUL-filled config) and #41874 (history loss/incomplete project-assignment migration). Please link or consolidate these reports as appropriate; a common root cause has not been confirmed.
This report is intentionally redacted: no local username, project names, account identifiers, credentials, raw databases or conversation transcripts are included. Sanitized recovery evidence has been retained locally.
ayaanexperimental-bit commentedon Sep 14, 2026
Windows desktop loses project registry after primary and backup state fail parsing
Environment
Observed failure
At 2026-09-13T12:04:49.433Z and 12:04:49.452Z, desktop startup logged:
The two call sites correspond to the primary
.codex-global-state.jsonand its.bakfallback. Both parse failures return null; the outer loader then returns an empty Map.The same startup subsequently logged:
Despite the four surviving database projects, the sidebar exposed no local projects. The local-projects cache was empty. Existing task records survived.
Reproduction already performed safely
The installed bundle's actual uE/dE loader functions were executed unmodified with an in-memory filesystem boundary. No live files were corrupted or modified.
All three characterization cases passed. This reproduces the empty-state fallback, not the origin of file corruption or every historical disappearance.
Bundle:
.vite/build/window-all-closed-KNH8jchn.js.Loader SHA-256:
a490ada7d97ab3516d0a8ebe4e90e90211dcfb6884a4973ccbb391932bcd6710.Expected behavior / requested remediation
.bak, without explicit flush in the inspected functions.Recovery and uncertainty
A backed-up, offline restoration of the original four-project registry and 18 exact task assignments made local projects visible again after startup. This is recovery, not a shipped prevention fix.
The producer of the NUL bytes remains unknown. An unclean Windows shutdown exists in system history, but causality has not been established. No claim of a confirmed disk failure is made.
lovasoa commentedon Oct 2, 2026
Linux/macOS workaround: fully quit ChatGPT/Codex, then paste this into a terminal and reopen the app afterward
This rebuilds the desktop project registry from surviving
state_5.sqliterecords. It saves the current settings first, preserves existing assignments and explicit projectless chats, and fills missing assignments only from existing database membership or an exact, unique project-root match. It does not edit SQLite. Remote-only projects cannot be reconstructed from the local database. This is a workaround, not a fix for the original corruption; the shorter command was checked on an isolated database fixture.