Skip to content

Desktop: config.toml zero-filled to NUL bytes after ungraceful shutdown — non-atomic write on Windows loses entire file content #26421

Open

Description

@tasmeer-landally

Summary

Codex Desktop on Windows writes ~/.codex/config.toml non-atomically and without FlushFileBuffers. If the OS loses power (or is force-rebooted) between the moment Codex's write() returns and the moment NTFS flushes the dirty page cache to disk, NTFS commits the file's new size to the directory metadata but never writes the data clusters. Per the file-system's zero-fill-on-read security policy, the file then reads as uniform 0x00 bytes from byte 0 to EOF, blowing away every user customization (plugins, MCP servers, sandbox mode, model settings, trusted projects).

On next launch Codex bails with:

failed to load configuration: C:\Users\<user>\.codex\config.toml:1:<size+1>: key with no value, expected `=`

because the TOML parser walks N NUL bytes as one runaway bare key and hits EOF without finding =.

Reproduction

  1. On Windows 10/11, launch Codex Desktop and let it write config.toml (any settings change, plugin install, or [projects.*] trust prompt will do).
  2. Within ~30s of the write — before Windows' lazy writeback flushes the page cache — cut power (or hold the power button until the machine shuts down hard).
  3. Boot back up, launch Codex Desktop.
  4. Expected: previous config loads, or Codex falls back to defaults cleanly.
  5. Actual: ~/.codex/config.toml is N bytes of 0x00. Codex refuses to start with the parse error above. The "Use backup sandbox" button doesn't fix it because that only swaps sandbox mode — the parser fails before sandbox setup even runs.

Forensic evidence from one occurrence

File: C:\Users\<user>\.codex\config.toml
Size: 4183 bytes
First 16 bytes: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Last 16 bytes:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
LF count: 0
CR count: 0
NUL count: 4183
Unique byte values across whole file: { 0x00 }

File mtime matched the user's last Codex action ~5 minutes before the power loss. Three sibling files in .codex/ (AGENTS.md, auth.json, chrome-native-hosts-v2.json) were untouched by the same crash window because they hadn't been re-written that session — they survived intact.

Root cause

This is the classic ext4 zero-after-crash pattern, just on NTFS. Codex's persistence path appears to be a straight open(path, O_TRUNC) → write() → close(), without:

  • writing to a temp file (config.toml.tmp),
  • FlushFileBuffers(handle) to force the dirty cache to disk,
  • MoveFileEx(tmp, dst, MOVEFILE_WRITE_THROUGH | MOVEFILE_REPLACE_EXISTING) for atomic replace.

Without these, the durability guarantee Codex appears to depend on doesn't exist on Windows.

Suggested fix

Adopt write-temp-then-rename atomic semantics for config.toml (and any other crash-critical files in ~/.codex/, e.g. auth.json, .codex-global-state.json, chrome-native-hosts-v2.json):

// pseudocode
let tmp = path.with_extension("toml.tmp");
{
    let mut f = File::create(&tmp)?;
    f.write_all(contents.as_bytes())?;
    f.sync_all()?;   // FlushFileBuffers under the hood on Windows
}
// On Windows: MoveFileExW(tmp, path, MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)
// On POSIX:   rename(tmp, path)
fs::rename(tmp, path)?;

This makes the worst possible crash leave either the old intact file or the new intact file on disk — never a zero-filled phantom.

Secondary observation (separate, possibly related)

When a user hits this and clicks "Use backup sandbox", Codex tries to set up the elevated admin sandbox, which on some machines fails with "Couldn't set up admin sandbox" (see #14808, #23249). That makes the "Use backup sandbox" recovery path effectively a dead end for affected users — they have to fix the config file manually before Codex will boot at all.

Workaround for currently-affected users

  1. Move the zeroed file aside: Move-Item ~/.codex/config.toml ~/.codex/config.toml.corrupt
  2. If you've ever shared a session that included a Get-Content config.toml agent call, your old config may be recoverable from the JSONL rollout file.
  3. Otherwise: start Codex with an empty config, set [windows] sandbox = "unelevated" if you hit the secondary sandbox bug, re-trust your projects on demand.

Environment

  • OS: Windows 11 Pro 10.0.26200
  • Codex Desktop: latest as of 2026-06-04
  • Reproduction trigger: power loss during a Codex session

Activity

  1. added
    bug
    app
    windows-os
    config
    on Jun 4, 2026
  2. alexdresko commented on Jun 4, 2026

    @alexdresko

    My codex app just crashed and I lost ALL of my projects and conversations.

  3. gNikro commented on Jul 8, 2026

    @gNikro

    Additional occurrence on Windows after an abrupt restart / forced reboot, on a newer Codex Desktop build.

    Environment:

    OS: Windows
    Codex Desktop / app build observed in config/runtime env: 26.623.141536
    Codex local state root: %USERPROFILE%\.codex
    Date observed: 2026-07-08
    

    User-visible symptom:

    Fix C:\Users\<user>\.codex\config.toml:1:6427: key with no value, expected `=`.
    After saving the file, reopen the thread.
    

    Logs contained repeated entries:

    Invalid configuration; using defaults. C:\Users\<user>\.codex\config.toml:1:6427: key with no value, expected `=`
    

    Forensic evidence:

    %USERPROFILE%\.codex\config2.toml        size=6426 bytes, nonzero byte count=0
    %USERPROFILE%\.codex\config.backup.toml  size=6426 bytes, nonzero byte count=0
    first 256 bytes of config2.toml: all 00
    

    So both the manually saved broken config and the adjacent backup TOML were fully zero-filled, not merely syntactically malformed.

    Impact in this occurrence:

    • Codex started using defaults after the parse failure.
    • Local project list was temporarily empty: app API returned {"schemaVersion":1,"projects":[]}.
    • Local threads were still present and recoverable from state_5.sqlite / list_threads; several private local workspaces were visible there, so session data was not fully lost.
    • Global MCP config was lost. Before repair, codex mcp list returned No MCP servers configured yet.
    • The affected profile lost or had to rebuild multiple global MCP servers.
    • Project-local MCP config survived where it lived outside the corrupted global file.

    Recovery performed locally:

    • Rebuilt %USERPROFILE%\.codex\config.toml from surviving active defaults, session history, project-local .codex/config.toml files, VS Code mcp.json, and old rollout evidence.
    • Re-added trusted [projects.*] entries using state_5.sqlite thread cwd values.
    • Re-added global MCP servers using recovered TOML fragments from prior rollout logs.
    • Verified the repaired file with Python tomllib.
    • Verified codex mcp list after repair:
    multiple global MCP servers enabled again
    

    This reinforces the original report: config writes need crash-safe atomic temp-file + flush + rename semantics on Windows, and Codex should preserve a last-known-good config or auto-recover from project/thread state instead of falling back to defaults and losing MCP/project settings after a single corrupted TOML write.

    Related broader state-loss issue: #26990

  4. cyanlink commented on Jul 25, 2026

    @cyanlink

    Additional occurrence on Windows, with a newer Desktop build and no known power loss or forced shutdown.

    Environment / timing:

    OS: Windows
    Codex Desktop build when diagnosed: 26.721.41059
    Previous-day build evidence: 26.721.30844
    Date observed: 2026-07-25
    In-app feedback ID: 019f9a01-3cbf-76b1-8c21-2bcb20338d24
    

    The app appeared normal the previous day. After the update/relaunch, the initial user-visible symptom was that all projects disappeared from the sidebar.

    Recovery behavior was unusual:

    1. I found an older conversation through Recent and interacted with/reopened it.
    2. After that, exactly one project reappeared in the sidebar, together with that project's conversation list.
    3. Those conversations still could not be opened.
    4. At the same time, Desktop displayed the “Finish Windows setup” prompt.

    Forensic evidence then showed:

    %USERPROFILE%\.codex\config.toml
    size: 5982 bytes
    nonzero byte count: 0
    SHA-256: 22575C4D5173905DEDE95DBFED575EC6DC129E87B0E4095F2EB0E5098E298C0F
    

    The app-server error was:

    C:\Users\<user>\.codex\config.toml:1:5983: key with no value, expected '='
    

    An adjacent backup of the config was also uniformly NUL-filled, so it had no recovery value.

    The project/conversation data itself was not deleted:

    • state_5.sqlite still contained the local threads and their workspace cwd values.
    • .codex-global-state.json had collapsed to a one-project state.
    • The local project migration markers were already recorded as completed (2026-07-13-local-projects and 2026-07-14-repair-metadata-local-projects), so restarting alone did not rebuild the sidebar.

    Local recovery required fully exiting Codex, replacing the invalid config, and reconstructing the project/global-state JSON from surviving pre-migration state plus state_5.sqlite. Both the primary global-state file and its adjacent backup had to be repaired before restart. After that, all 8 projects and their conversations returned and could be opened.

    This looks like the same zero-filled config.toml failure described in this issue, combined with the broader project/sidebar state loss tracked in #26990. The important difference is that this occurrence was correlated with a Desktop update/relaunch rather than a known power-loss event. The “Finish Windows setup” prompt also appears to be a misleading downstream symptom: invalid config/default fallback prevented normal Desktop settings and Windows sandbox initialization while the durable thread data remained present.

    No raw logs, full config, project names, prompts, tokens, or private paths are included here. I can provide specific redacted diagnostics if maintainers identify the fields needed.

  5. Gamooly commented on Sep 9, 2026

    @Gamooly

    Additional occurrence on September 9, 2026, on a substantially newer Codex Desktop build. I also have some implementation evidence that may refine the original root-cause hypothesis.

    Environment:

    OS: Windows 11 Pro 25H2, build 26200.9445
    Microsoft Store package: OpenAI.Codex 26.903.8094.0
    Desktop bundle version: 26.903.61454
    App-server / CLI version reported at startup: 0.153.4
    Codex state root: %USERPROFILE%\.codex
    

    Observed corruption:

    %USERPROFILE%\.codex\config.toml
    size: 5190 bytes
    NUL bytes: 5190
    nonzero bytes: 0
    SHA-256: 5bfe5b7316cb9049fa98a0b81c36da7d9854cdbc40ad1b3bb5947f75ce62b9d1
    

    The resulting parser error was:

    config.toml:1:5191: key with no value, expected `=`
    

    The user-visible symptoms progressed through:

    1. "Couldn't check Windows setup"
    2. repeated config RPC failures
    3. later, Desktop remaining at the splash/loading screen

    Restoring a valid same-day Windows Previous Versions snapshot of config.toml immediately recovered the application. config/read, configRequirements/read, and Windows sandbox readiness all returned to normal afterward.

    There was also a second independently generated Codex file from the same startup sequence:

    unified-computer-use/.../.mcp.json
    size: 2475 bytes
    NUL bytes: 2475
    nonzero bytes: 0
    

    The preserved .mcp.json creation timestamp is 3 ms earlier than the preserved config.toml timestamp.

    An important timing detail: config/read still succeeded several seconds after those file creation timestamps. The first surviving explicit TOML parse failure occurs only after a later unclean boot. Therefore I cannot establish that the files became zero-filled at the moment they were created.

    All timeline times below are EDT (UTC-04:00).

    Windows timeline around the event included:

    14:29:30  user-requested restart recorded by Event 1074
    14:29:31  Event Log service stops cleanly
    14:33:52  Windows starts
    14:35:44  Codex Desktop launches
    14:35:51  startup reconciliation; preserved files have creation timestamps here
    14:35:56  config/read still succeeds
    14:38:00  another Windows boot begins
    14:38:03  Kernel-Power 41 records the preceding shutdown as unclean
    16:01:37  later Windows boot begins, with changed NVMe slot topology
    16:02:08  first surviving explicit config.toml parse failure
    

    The owner was intentionally changing NVMe slot configuration during this period. The surviving logs do not establish whether the later unclean shutdown was an interrupted intentional shutdown, a hang, power removal, or another failure.

    I inspected the currently installed Desktop bundle and version-matched 0.153.4 backend source.

    There are multiple config persistence paths:

    • The Windows notify helper still contains a direct fs/promises.writeFile(config.toml, ...) path with no temporary replacement or explicit flush. However, that helper logged already-present immediately before this occurrence, so that particular invocation does not appear to be the writer here.
    • Startup browser/computer-use synchronization performs automatic configuration reconciliation and sends config/batchWrite.
    • The generated plugin .mcp.json is written to a temporary sibling and renamed over the destination.
    • The version-matched app-server config writer serializes the complete TOML and uses NamedTempFile -> write_all -> persist(destination).

    The backend atomic-write path contains no explicit sync_all / fsync before persist. The version-matched config writer is here: https://raw.githubusercontent.com/openai/codex/rust-v0.153.4/codex-rs/utils/path-utils/src/lib.rs

    The matching tempfile Windows implementation uses MoveFileExW(..., MOVEFILE_REPLACE_EXISTING) and does not add MOVEFILE_WRITE_THROUGH or call FlushFileBuffers: https://raw.githubusercontent.com/Stebalien/tempfile/v3.27.0/src/file/imp/windows.rs

    Both preserved files are entirely NUL-filled, and their creation timestamps are only 3 ms apart. Subsequent config/read requests still succeeded. This supports investigating durability of the startup replacement sequence, but does not establish when either file became zero-filled or prove which write path caused the corruption.

    In other words, atomic replacement prevents readers from observing a partially serialized file, but without an explicit durability flush it may still be possible for an unclean shutdown to lose recently written cached payload data.

    Other possible causes were investigated:

    • No automation turn or monitor-command execution was found in the retained history for either incident window.
    • Later 3DMark / NVIDIA instability occurred well after the 14:35 Codex writes and has no demonstrated causal connection.
    • No relevant Disk, NTFS, or WHEA fault was found around the 14:35 write window.
    • One NVMe controller error was recorded at the later hardware-change boot. It does not establish an SSD fault, and no causal connection to the zero-filled files has been demonstrated.

    Both corrupt originals are preserved.

    This looks like another current-build occurrence of the failure signature in this issue, but with evidence suggesting maintainers may also want to review durability guarantees around the temp-file + rename path.

    The startup symptoms also resemble #34126 and #38500.

    No raw logs, configuration contents, project names, prompts, tokens, credentials, or private user paths are included here. I can provide additional narrowly redacted diagnostics if maintainers need a specific field.

  6. walterdalec commented on Sep 11, 2026

    @walterdalec

    Confirming this issue is still occurring on Windows with Codex Desktop 26.903.9818.0 as of September 10, 2026.

    Symptoms

    Codex showed the splash/logo screen, then opened to a blank white window.
    UI elements briefly flashed every few seconds.
    Updating/reinstalling the application did not resolve the problem.

    The desktop logs repeatedly reported:

    failed to read configuration layers:
    C:\Users<user>.codex\config.toml:1:6511:
    key with no value, expected =

    The same error affected config requirements, permissions, feature enablement, plugins, and MCP startup. Authentication itself was succeeding.

    I inspected ~/.codex/config.toml directly:

    Character length: 6510
    File byte length: 6510
    Line count: 1

    Format-Hex showed that the entire file consisted of 0x00 bytes. All 6,510 bytes had been replaced with NUL characters.

    The parser error therefore occurs at position 6511, immediately after the end of the zero-filled file.

    Recovery

    With Codex closed, I renamed the corrupted configuration:

    Rename-Item "$env:USERPROFILE.codex\config.toml" "config.toml.corrupt"

    After relaunching Codex, the desktop application immediately loaded normally and presented the onboarding screen. After completing onboarding, projects/workspaces and normal functionality appeared intact.

    This machine had experienced significant system instability around the time the problem began, so this may be related to an interrupted/non-atomic write of config.toml.

    Updating Codex did not resolve the issue because the corrupted file persisted in the user profile across application updates.

    It may be worth protecting config.toml writes with an atomic temp-file + rename operation and/or detecting a NUL-filled/unparseable config at startup and automatically falling back to a backup/default configuration instead of leaving the desktop UI unusable.

  7. tedparkes commented on Oct 11, 2026

    @tedparkes

    Title: Windows local chat transcript permanently zero-filled after BSOD; repeated zero-filled config.toml

    Summary
    A Windows Codex Desktop user experienced repeated BSODs and had to replace
    config.toml more than once. One local chat cannot be resumed because its rollout
    JSONL is 108,753 bytes of 0x00. This is persistent loss of transcript content,
    not an empty-file startup race: two later Windows Previous Versions snapshots
    contain exactly the same all-zero file, and local projected history contains
    no records from which to rebuild that chat.

    Environment observed on October 11, 2026

    • Microsoft Windows 11 Home, 25H2, build 26200.9457.
    • Installed Microsoft Store package: OpenAI.Codex 26.1007.2314.0.
    • Earlier crash-time app versions have not been established.
    • User reported RAM/system instability and reverting to the original 16 GB RAM.
    • Real Windows bugcheck/unclean-shutdown events are present. This report does
      not claim Codex caused the BSODs or establish a hardware/software root cause.

    Observed data loss

    • Damaged file: %USERPROFILE%.codex\sessions\2026\10\08\rollout-.jsonl
    • Size: 108,753 bytes. NUL bytes: 108,753. Nonzero bytes: 0.
    • SHA-256: 5711530397b9611b180bb6ac1ae4ec1a0dec01045aa7d29aa568024d364c88c5
    • Recorded creation/write time: October 8, approximately 12:44:31 CDT.
    • Windows recorded a system bugcheck at approximately 12:45:22 CDT that day.
      Those timestamps alone do not establish the corruption time or causal writer.
    • Desktop error: Failed to resume chat; failed to read session metadata;
      rollout file is empty.
    • October 10 snapshots at 16:11 and 21:44 CDT both preserve identical all-zero
      transcript copies. Neither snapshot's thread_history database contains items,
      turns, or realtime items for the affected chat.
    • Current thread_history database also has no items/turns for the chat; no
      cached timeline records or turn summaries were found for it.

    Configuration corruption evidence

    • Preserved October 8 config backup: 5,716 bytes; all 5,716 bytes are NUL.
    • Preserved October 11 corrupt config: 5,619 bytes; all 5,619 bytes are NUL.
    • October 10 Previous Versions contain valid TOML config files.
    • Current manually recovered config parses successfully.

    Extent checked

    • Every local sessions/archived_sessions JSONL was scanned: 127 files,
      2,279,549,240 observed bytes; 126 valid JSONL files and one all-NUL file.
    • Cross-checked all 124 entries in the current thread database: 123 reference
      valid files; only the affected chat references a corrupted file. No missing
      referenced files were found. Windows extended-path prefixes were normalized.
    • Both current state/history database snapshots pass SQLite quick_check.
    • Older snapshot indexes contain 94 and 112 threads, respectively. Every one
      of those IDs remains in the current index; no additional disappeared indexed
      chats were detected between those snapshots and the current state.
    • Valid JSON cannot prove that every final pre-crash message was flushed, and
      these checks cannot detect chats removed before all available snapshots.

    Related reports

    Requested investigation

    1. Review crash durability of rollout/config writes on Windows, including
      flush/sync behavior, replacement durability, and preservation of older data.
    2. Provide a last-known-good/versioned recovery path for important local chats
      and clearly show failures to persist their contents.
    3. Document whether local Desktop chats have any automatic recoverable online
      copy, and how users or support can retrieve it after local transcript loss.
    4. Improve the zero-filled-file error so it clearly identifies possible data
      corruption and recovery options rather than only calling the rollout empty.

    Local mitigation
    Verified versioned backups now run through Windows Task Scheduler hourly and
    at sign-in, outside the Codex home directory. Originals and recovery candidates
    were preserved; the damaged chat was not overwritten with fabricated metadata.

    Privacy
    This report omits chat content, chat titles, thread IDs, account identifiers,
    credentials, raw databases/logs, and private absolute paths. Private audit
    files and complete backups should not be uploaded to a public issue.

  8. SunGang-pine commented on Oct 17, 2026

    @SunGang-pine

    Still happening on Windows after a sudden power loss (Oct 2026).

    • Symptom: Codex/ChatGPT desktop shows “Unable to load ChatGPT configuration” / config.toml:1:23260: key with no value, expected '='
    • Cause matches this issue: ~/.codex/config.toml corrupted (NUL-filled) after hard power cut
    • Workaround: rename/move the broken config.toml, relaunch; app regenerates defaults
    • Impact: custom settings (e.g. pet/personalization, MCP, model prefs) reset; reinstall does not help because the bad file stays in the user profile

    Please prioritize atomic write + flush on Windows, and auto-fallback when config.toml is unparseable/NUL-filled so users aren’t stuck behind a manual rename.

  9. UrosVel97 commented on Oct 24, 2026

    @UrosVel97

    Additional recurrence on Windows, observed on 24 October 2026. Reporting with the affected user's explicit authorization. The same installation has repeatedly required configuration recovery and restoration of local project visibility.

    Environment

    • Windows 11 Pro, reported version 26H2, build 26300.9711.
    • Microsoft Store package: OpenAI.Codex 26.1021.3705.0.
    • App-reported version: 26.1021.31345, build 21828, production channel.
    • Bundled CLI/app-server: 0.164.0-alpha.11.1.

    Confirmed corruption and impact

    • The preserved broken config.toml is 3,972 bytes long; all 3,972 bytes are NUL (0x00). A separately preserved older configuration backup is also entirely NUL-filled (4,555 bytes).
    • Startup logs report NUL parsing failures for both .codex-global-state.json and its adjacent backup, and a configuration load failure for config.toml.
    • Resetting the configuration restored startup but removed local plugin marketplace registrations/enabled settings. Plugin source directories and cached packages survived and were subsequently re-registered.
    • Local projects disappeared from the sidebar and existing chats lost their visible grouping. The SQLite database remained readable: PRAGMA quick_check = ok, and project/root records plus the relevant thread-to-project links were intact.
    • Recovery restored three affected project entries and nine chat associations, preserving their existing identities. This was a recovery of existing data, not creation of replacement conversations.

    Observed timeline on 24 October (UTC+02:00)

    • 13:16:48: app update download completed.
    • 13:18:26: the updated app started successfully, without the subsequent JSON/TOML parse failures.
    • 13:28:55: Windows booted again.
    • 13:28:58: Kernel-Power 41 recorded an incomplete previous shutdown, with BugcheckCode=0; Kernel-Boot also reported LastShutdownGood=false.
    • 13:54:16: the first surviving startup evidence of NUL-filled global state and configuration.
    • Following the user's config reset, the project registry still failed to load even though the app-server reported five database projects.

    The user reports initiating restarts through Start menu > Restart, not intentionally cutting power. The logs nevertheless indicate an incomplete shutdown in this incident. We have not captured the process or filesystem operation that zeroed these files, and the timeline does not prove updater causation.

    Recovery/persistence observations

    The running desktop overwrites external edits to its in-memory project registry, so recovery required fully closing the app before restoring the relevant metadata. After reopening, the three restored projects and nine associations were verified through desktop APIs.

    Inspection of the installed desktop bundle indicates that the global-state primary and adjacent backup can both be written from the same new state. When both startup copies are unreadable, subsequent persistence can therefore leave both copies without the former registry. This deserves review as a recovery/durability issue; it does not identify the original corrupting writer. The TOML app-server writer is a separate path.

    Related project/sidebar recovery issue: #53251.

    Causality limits

    There is independent Windows instability on this machine: a 23 October kernel crash dump contains a confirmed one-bit instruction mismatch against the matching Microsoft image. This could be a contributing factor, but neither a defective RAM module nor a causal link to every Codex corruption event has been established. That dump does not show shutdown in progress. We are not claiming Codex caused the Windows crash, or that all affected users have a hardware fault.

    Requested product improvements

    Please investigate durable configuration/global-state writes and preservation of a last-known-good copy; validate and quarantine NUL-filled state on startup; and provide a supported recovery/reconciliation path that preserves local projects, chat membership and plugin registrations after a bad state file. Repeated resets currently require substantial manual reconstruction.

    Only this sanitized summary is being shared. No raw logs, configuration contents, memory dumps, account identifiers, project names/paths, chat IDs or conversation contents are attached.

  10. sergiobm14 commented on Oct 28, 2026

    @sergiobm14

    Confirmed additional occurrence — Windows, October 28, 2026

    I experienced a completely NUL-filled config.toml with Codex Desktop on Windows. This report records the observed corruption and recovery; it does not establish which process or operation caused the corruption.

    Symptoms

    Codex could not load its configuration. The reported parser error was:

    config.toml:1:7138: key with no value, expected '='
    

    VS Code identified the file as binary or using unsupported encoding, and Notepad did not show readable configuration text.

    Verified byte-level evidence

    The preserved copy of the affected configuration was read with PowerShell using [System.IO.File]::ReadAllBytes, then every byte equal to zero was counted:

    Total bytes:       7137
    NUL (0x00) bytes:  7137
    Nonzero bytes:        0
    NUL percentage:     100%
    

    This confirms that the entire preserved file contains 0x00, rather than merely a malformed TOML setting or an editor display problem. The reported parser column, 7138, is one position beyond the 7137-byte file.

    Recovery observed

    1. Preserved the corrupted configuration as a local backup and moved it out of the active config.toml path.
    2. Relaunched Codex and allowed a new configuration to be generated.
    3. Codex started successfully again. The replacement configuration was 2867 bytes.

    Previous conversations and projects appear intact; this is a user-visible observation, not an exhaustive integrity audit. Regenerating the configuration does not establish that all previous preferences or integrations were restored.

    Limits and requested investigation

    The original cause and exact time of corruption remain unknown. No unexpected shutdown has been confirmed for this occurrence. I do not have a reliable reproduction sequence, and the affected app version and Windows build were not captured in this diagnosis.

    Please investigate crash durability across configuration write paths, including temporary-file replacement and explicit flush/sync behavior, preserve a last-known-good validated backup, and provide an actionable startup recovery path for NUL-filled or otherwise unparseable configuration. These are investigation requests, not a claim that a particular write implementation caused this case.

    The corrupted copy is preserved locally. No configuration files, raw logs, credentials, account identifiers, project details, or private absolute paths are attached or included.

  11. MAR-Toledo commented on Oct 28, 2026

    @MAR-Toledo

    Additional confirmed occurrence — Windows laptop battery depletion (October 28, 2026)

    I would like to contribute another occurrence of this issue, including byte-level verification of the corrupted configuration file.

    Environment

    • Windows laptop
    • OpenAI ChatGPT/Codex desktop application
    • Affected file: %USERPROFILE%\.codex\config.toml
    • Exact application version and Windows build: Not collected

    Timeline and symptoms

    1. My laptop ran out of battery while the desktop application was open.
    2. After restarting the laptop, the application failed to launch.
    3. The following configuration error appeared:
      config.toml:1:4012: key with no value, expected '='
    4. Clicking Retry repeatedly produced the same error.
    5. I had not manually modified the .codex folder or its configuration files.

    Forensic verification using PowerShell

    I preserved the original corrupted file by renaming it to config.toml.bak.

    I then examined its contents using Format-Hex and [System.IO.File]::ReadAllBytes().

    Confirmed results:

    • Total file size: 4,011 bytes
    • Nonzero bytes: 0
    • Entire file content: 100% NUL (0x00) bytes

    This confirms that the file was completely zero-filled, rather than simply containing an invalid TOML setting.

    Recovery

    1. Renamed config.toml to config.toml.bak.
    2. Relaunched the desktop application.
    3. The application opened successfully.
    4. Restarted Windows to verify the fix.
    5. The application launched normally again after the restart.

    Suspected trigger

    The problem appeared immediately after the laptop lost power because its battery was depleted while the application was running.

    This timing strongly suggests a possible connection between an unexpected shutdown and configuration corruption. However, the exact underlying cause has not been independently established.

    Suggested improvement

    Please investigate configuration-file durability during unexpected shutdowns and consider implementing automatic recovery from a valid backup when config.toml contains only NUL bytes or cannot be parsed.

    This would prevent users from being locked out of the desktop application after an unexpected power interruption.

    I hope this additional evidence helps the investigation.

  12. 4245877 commented on Nov 10, 2026

    @4245877

    Additional confirmed Windows incident (2026-11-10), with log timestamps that may help locate the config persistence failure. This appears to match this issue and #34126.

    Environment

    • Windows, local timezone UTC+02:00 (exact Windows build not captured)
    • VS Code Codex extension: 26.1021.22027-win32-x64; CLI 0.164.0-alpha.11.1
    • Codex desktop/app-server CLI: 0.167.0-alpha.3.2
    • Shared configuration: %USERPROFILE%\.codex\config.toml (username redacted)

    Observed evidence

    • At 12:42:35 and 12:42:36 local time, Codex app-server logs recorded two config/batchWrite requests.
    • The config.toml file modification time was 12:42:36.
    • Windows subsequently shut down unexpectedly at approximately 12:43:52 (reported via Kernel-Power event 41 / EventLog 6008): about 76 seconds after the last recorded config write. This timing is consistent with a crash-durability problem but does not by itself establish the precise cause of the zero-fill.
    • Following restart, the file was 3,779 bytes, all 3,779 bytes equal to 0x00, with 0 CR and 0 LF.
    • Both Codex clients failed to read the shared config with config.toml:1:3780: key with no value, expected '=' (position 3780 = 3779 + 1). The VS Code CLI codex login status exited with code 1 before recovery.
    • A byte-for-byte backup of the damaged file was preserved. No other copy of the original settings was found in the user profile or available application logs.

    Recovery / verification

    • Removed the NUL-only contents, leaving a valid empty TOML file. No other configuration files were modified during repair.
    • Python tomllib parsed it successfully.
    • VS Code extension CLI: codex login status -> Logged in using ChatGPT (exit code 0); codex mcp list also returned successfully.
    • Desktop app-server CLI: codex login status -> Logged in using ChatGPT (exit code 0).
    • GUI startup was not independently verified after the fix. Original custom settings could not be recovered from the zero-filled file.

    Request
    Please investigate the config/batchWrite persistence path on Windows, ensure crash-safe writes (including durable backup/atomic replacement where applicable), and provide an actionable recovery path for a corrupt/NUL-filled config.toml. The current failure can cause both clients to reject their shared config and can permanently lose user customization.

    No auth tokens, full logs, account identifiers, or unredacted local paths are included here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugconfigwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions