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.
What
Claude 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.
- 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. - The project config helpers return early when the file is missing and the environment variable is set.
- A change that only touches a cached key no longer counts as significant enough to save.
- Logout now reports a failure when it cannot save the config file.
/logoutshows an error saying your account or API key may still be in the config file and to runclaude auth logoutagain.claude auth logoutprints 'Logout failed: …'. Before, logout always reported success. - Logout also prunes or deletes additional stores where credentials are kept, and with the environment variable set it also clears
primaryApiKey.
Why
A 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.
It is not settled whether the protection for the main config file needs `CLAUDE_CODE_ENABLE_CONFIG_MISSING_READ_GUARD` set, or applies…