{"version":"2.1.318","anchor":"atomic-file-write-bigint-stat-check-ebadf-forgiving-flush","canonical_anchor":"atomic-file-write-bigint-stat-check-ebadf-forgiving-flush","heading":"Safer saving of config and credential files","tier":"notice","area":"File Writes","scope":"individual","heads_up":true,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.318\/e\/atomic-file-write-bigint-stat-check-ebadf-forgiving-flush","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.318","markdown":"### Safer saving of config and credential files\n\nConfig and credential file saves now flush to disk, retry once when needed, and refuse to treat a doubtful missing config as empty\n\n**What**\n\nClaude Code keeps your settings in a config file and your login details in a credential file. The code that saves these files has been reworked so a save is less likely to be lost or to wipe out a good file.\n\n- The shared file-writing helper now checks files with more precise size and time readings (`bigint:true`) and takes a `flushForgivesEbadf` option. Flushing means forcing the data out to the disk; with this option, one kind of operating-system error (EBADF) during the flush is not treated as a failure. Before, the flush was called directly and its errors were ignored.\n\n- If the last step of a save, renaming the new file into place, fails, the helper checks what happened and may retry the whole save once. A save is reported as `replaced` when the target file changed while it was being written.\n\n- Credential saves, through secure storage or the plain-file fallback, now use this helper with flushing switched on and owner-only permissions (mode 384). When a credential save fails, a handler now runs before the failure is returned.\n\n- The config store now remembers a backup path when the file could not be read at startup, leaves an unreadable (unparseable) file alone, and takes one extra look when the file seems to be missing.\n\n- When a fallback config save fails, a `doubtsNoFile` flag is set. If the global config file is then not found and that flag is set, loading stops with the error \"global config not found though there is reason to doubt it\" instead of quietly carrying on as if there were no config.\n\n**Why**\n\nThese changes aim to stop a brief disk or file-system hiccup from leaving a half-written credential file, or from making Claude Code treat a temporarily missing config as empty and then overwrite or reset it. If you see the new \"reason to doubt it\" error, Claude Code is refusing to guess rather than starting with blank settings.\n\n- Area: File Writes\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: yes"}