Claude Code "Sign in again to take your previous account or API key off the config file"
Claude Code warns your previous account or API key may still be in ~/.claude.json after a login or logout. Re-run claude auth login or logout to retry the save.
Sign in again to take your previous account or API key off the config file.If this warning appears after you sign in, an account you used before may still be stored in ~/.claude.json. Run claude auth login in your shell once more and Claude Code retries the save that removes the replaced account or API key from the file.
A sibling warning exists for logging out, and the command to re-run differs, so match the wording first.
| Warning | Appears | Re-run |
|---|---|---|
Sign in again to take your previous account or API key off the config file. | After you sign in | claude auth login |
Your account or API key may still be in the config file. Run claude auth logout. | After /logout or claude auth logout | claude auth logout |
[1] Pick the row that matches when the warning appeared. Both messages point at ~/.claude.json, which holds account details, per-project trust decisions, personal MCP servers, and UI toggles. If you set CLAUDE_CONFIG_DIR, the file lives under that directory instead.
[2] For the warning after a login, run the login command again from a regular shell, not inside a Claude Code session.
$ claude auth loginThe docs say only that Claude Code then retries the save that takes the replaced account or API key off the file. They don't list a success message for this command, so judge the result by whether the warning comes back.
[3] For the warning after a logout, re-run the logout the same way.
$ claude auth logoutWhen the save goes through, the docs say the command prints this line:
Successfully logged out from your Anthropic account.By the docs' description, Claude Code has already signed this process out but couldn't confirm that the file no longer holds your account. Either the save didn't land, or the file couldn't be read back to check.
[4] Both warnings carry one more sentence. If a Console login created an API key on Linux or Windows, that key may still be in ~/.claude.json too. The fix is still the single command from [2] or [3].
[5] If the same warning returns after re-running the command, the two warning sections have no further step. The docs don't state the cause of this warning, so none is asserted here. The same errors page does have a section saying that a full disk or quota on the config directory's disk keeps a new login from being saved, and that signing in again won't help then. That isn't documented as the cause of this warning; treat free disk space (df -h ~) as a place worth a look. A request that fails with a 401 after login is covered in OAuth token has expired (401).
Tell it apart from other login messages
| Message | Meaning | Post |
|---|---|---|
Sign in again to take your previous account or API key off the config file. | Previous account or key may remain in the file after a login | this post |
Your account or API key may still be in the config file. Run claude auth logout. | The file couldn't be checked after a logout | this post |
Couldn't save your login | The login wasn't written to the credential store | Couldn't save your login |
Could not resolve authentication method | The session has no credential at all | Could not resolve authentication method |
Your apiKeyHelper script is failing | The key script returned no usable key | apiKeyHelper script is failing |
| Any other error text | Claude Code errors by message |