{"version":"2.1.317","anchor":"config-file-creation-guard-never-overwrite-a-file-that-appe","canonical_anchor":"config-file-creation-guard-never-overwrite-a-file-that-appe","heading":"Config saves stop overwriting an existing file, and logout says when it could not save","tier":"notice","area":"Internals","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.317\/e\/config-file-creation-guard-never-overwrite-a-file-that-appe","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.317","markdown":"### Config saves stop overwriting an existing file, and logout says when it could not save\n\nClaude Code no longer overwrites a config file it failed to read, and logout now fails visibly when it cannot save the config file\n\n**Unclear.** It is not settled whether the protection for the main config file needs `CLAUDE_CODE_ENABLE_CONFIG_MISSING_READ_GUARD` set, or applies without it.\n\n**What**\n\nClaude Code keeps your settings, and some sign-in details, in a config file. Two changes make saving that file safer. Both are linked to a new environment variable (a named setting you can set before starting a program), `CLAUDE_CODE_ENABLE_CONFIG_MISSING_READ_GUARD`, which did not exist before.\n\n- When saving the global config file through its fallback path, Claude Code can now create the file only if it does not exist yet (`createOnly`). If a file has appeared there in the meantime, the write is refused and the save is retried on top of the existing file, up to a limit. Before, this fallback always overwrote the file, so a moment when the file could not be read could wipe a real config.\n\n- The project config helpers return early when the file is missing and the environment variable is set.\n\n- A change that only touches a cached key no longer counts as significant enough to save.\n\n- Logout now reports a failure when it cannot save the config file. `\/logout` shows an error saying your account or API key may still be in the config file and to run `claude auth logout` again. `claude auth logout` prints 'Logout failed: \u2026'. Before, logout always reported success.\n\n- Logout also prunes or deletes additional stores where credentials are kept, and with the environment variable set it also clears `primaryApiKey`.\n\n**Why**\n\nA config file that is briefly unreadable should no longer be replaced with an empty one, which could lose your sign-in and settings. And if logout cannot finish, you are told so, instead of believing you are signed out while your key is still on disk.\n\n- Area: Internals\n- Tier: You'll notice\n- Useful: 3\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: no"}