OmniscioGuidesClaude Code login errors
Claude Code login errors: causes and fixes
This page covers the sign-in errors Claude Code prints when a credential is missing, rejected, or no longer good. Every message is quoted from Anthropic's own documentation, word for word, and each section names the page and anchor its message and steps come from. If you are hunting one message in particular, the list below links straight to it, and a short section after them collects the steps that make these errors worse. For the errors that are not about signing in, the Claude Code error messages guide covers the rest.
Messages and steps read from Anthropic's documentation on October 23, 2026. By the Omniscio team. Updated .
Find your sign-in error
Search this page for a few words of the message you saw. Claude Code changes its wording between releases, so each section shows the current message and, where the non-interactive run prints a different line, that one too.
- Not logged in
- Could not resolve authentication method
- OAuth token revoked or expired
- API Error: 401 Invalid authentication credentials
- Login expired
- Could not refresh your login because another Claude Code process is refreshing it
- Couldn't save your login
- Couldn't start the local listener that receives the browser sign-in
- Sign-in timed out while waiting for you to continue
- Anthropic profile login expired
Not logged in
Not logged in · Please run /loginAuthentication required · Sign in again to continueWhat it means. Claude Code found no valid credential for this session, so it has nothing to send your request with. A session the Claude Desktop app runs, such as the Code tab, prints the second line for the same condition and signs you in from the app.
How to fix it
- Run
/loginto authenticate with your Claude subscription or Console account. - If you have just signed in with your claude.ai account in another Claude Code window that uses the same configuration directory, leave this session alone: it starts using that login on its own. On macOS before v2.1.286 it could keep showing the message after you signed in elsewhere, and there a restart is the fix.
- If you expected an environment variable to authenticate you, confirm
ANTHROPIC_API_KEYis set and exported in the shell where you launchedclaude. - For CI or automation where interactive login is not possible, configure an
apiKeyHelperscript that fetches a key at startup, as described in the settings reference. - Read authentication precedence to understand which credential Claude Code uses when several are present.
- If you are prompted to log in over and over, work through the system clock checks and the macOS credential-storage recovery steps in Anthropic's install troubleshooting.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
Could not resolve authentication method
Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omittedWhat it means. The session reached the API client with no credential at all, which is how a background worker starts when it is launched without one. An interactive run, a -p run and an Agent SDK program hit the same condition but report it as Not logged in and write this string only to their debug log, so if you found it there, the first section above is the one to follow.
How to fix it
- Upgrade to v2.1.176 or later if this appears in a background session, or in one running on Anthropic's own infrastructure, and your credentials are already configured.
- Confirm
ANTHROPIC_API_KEY,CLAUDE_CODE_OAUTH_TOKENor your cloud provider credentials are set in the environment that launches the worker, not only in your interactive shell. - For the Agent SDK, see the authentication setup in the quickstart.
- Run
/statusin an interactive session in the same environment to confirm which credential source resolves.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
OAuth token revoked or expired
OAuth token revoked · Please run /loginPlease run /login · API Error: 401 OAuth token has expired ...Failed to authenticate: OAuth token revoked. Please log in again or contact your administrator.Failed to authenticate. API Error: 401 OAuth token has expired ...What it means. Your saved login is no longer valid: revoked means you signed out everywhere or an admin removed access, and expired means the automatic refresh failed during the session.
How to fix it
- Run
/loginat the Claude Code prompt to sign in again. - If your
-pcommand or Agent SDK program uses a saved login, runclaudein the same environment, complete/login, then run the command or program again. For automation that cannot sign in interactively, authenticate withANTHROPIC_API_KEYor generate a long-lived token withclaude setup-token. - If you authenticate with the
CLAUDE_CODE_OAUTH_TOKENenvironment variable, Claude Code keeps sending the value you set after a request fails with a 401, rather than switching to a stored login's token./statusshows this credential as anAuth tokenrow readingCLAUDE_CODE_OAUTH_TOKEN. Generate a fresh token withclaude setup-tokenand restart with it, or unset the variable and run/login. - For repeated prompts to log in across launches, work through the system clock checks and macOS credential-storage recovery steps in Anthropic's install troubleshooting.
- For other failures, including
403 Forbiddenand browser sign-in problems, see Login and authentication.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
API Error: 401 Invalid authentication credentials
Please run /login · API Error: 401 Invalid authentication credentialsWhat it means. The API read your credential and rejected the account or organization behind it, so an expired token is not the cause.
How to fix it
- If
/statusshows anAPI keyrow that is not marked as not in use, an approvedANTHROPIC_API_KEYis the active credential and takes precedence over your login, so/logindoes not replace it. Rotate the key in the Claude Console, or fall back to your subscription by runningunset ANTHROPIC_API_KEY, or in PowerShellRemove-Item Env:ANTHROPIC_API_KEY. - If
/statusshows only your login, run/loginonce. If the credential was revoked, a fresh login replaces it. - If the same message returns for the same login account, the account or organization is no longer active. Check the account and organization that
/statusreports, and ask your organization admin to restore access. - If
ANTHROPIC_BASE_URLpoints at an LLM gateway, the text after401is your gateway's message rather than Anthropic's, and/logindoes not change it. Fix the credential your gateway expects instead. - If every request fails with a
401once your gateway has the credential it expects, check whether the gateway is rejecting the tool search fields Claude Code sends by default. SetENABLE_TOOL_SEARCH=falseand try again, as Anthropic's note on tool search through a gateway describes. Before v2.1.304, tool search was off behind a gateway unless you turned it on withENABLE_TOOL_SEARCH.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
Login expired
Login expired · Please run /loginFailed to authenticate: OAuth session expired and could not be refreshedWhat it means. Claude Code tried to renew your saved claude.ai login, the OAuth service rejected the stored refresh token, and Claude Code cleared the saved credentials, so every request stops locally until you sign in again.
How to fix it
- Run
/loginto sign in again. Retrying without signing in shows the same message on every request. - If you sign in with your claude.ai account in another Claude Code window, see Not logged in above for when this session starts using that login on its own.
- In non-interactive mode, run
claudein the same environment, complete/login, then rerun your command. For automation that cannot sign in interactively, authenticate withANTHROPIC_API_KEYor generate a long-lived token withclaude setup-token. - If signing in keeps failing, see Login and authentication.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
Could not refresh your login because another Claude Code process is refreshing it
Could not refresh your login because another Claude Code process is refreshing it (or exited mid-refresh) · Try again in a minute; if it keeps happening, close other Claude Code windows or sign in again with /loginFailed to refresh OAuth token: another Claude Code process is refreshing it or exited mid-refresh. This is usually transient; retry in a minute, and if it persists close other Claude Code processes or sign in againWhat it means. Your saved login had expired and needed renewing, but another Claude Code process on the same machine held the shared refresh lock, so the renewal made no progress while this session waited.
How to fix it
- Try again in a minute. If another process completes the refresh first, this session uses the renewed login.
- If the message keeps returning, close other Claude Code windows and processes, then retry.
- If it returns with no other Claude Code process running, run
/login. Signing in again does not wait on the refresh lock.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
Couldn't save your login
Couldn't save your login. If your Mac's keychain is locked, unlock it and log in again.Couldn't save your login. Try logging in again.What it means. You signed in with claude.ai, but Claude Code could not save the login to its credential store, so the sign-in did not complete. The first line is the macOS form and names a locked login keychain as one reason, which can happen after sleep or idle; the second is what every other platform prints.
How to fix it
- On macOS, where the message names the keychain, make sure the login keychain is not locked, then run
/loginagain. - On other platforms, where the message does not name a keychain, run
/loginagain. - If the login still does not save, work through the keychain and credential-storage recovery steps in Anthropic's install troubleshooting.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
Couldn't start the local listener that receives the browser sign-in
The browser can't return the sign-in to Claude Code automatically. After you sign in, paste the code shown.Couldn't start the local listener that receives the browser sign-in. Try again.What it means. Claude Code could not open the port on 127.0.0.1 where your browser hands the sign-in result back. Only the second line is a failure: the sign-in stopped. With the notice beginning The browser can't return the sign-in to Claude Code automatically, the sign-in carries on, and you finish it with a code you paste.
How to fix it
- For the notice that begins
The browser can't return the sign-in to Claude Code automatically, there is nothing to fix first. Open the URL shown under the notice in a browser and sign in. The browser then shows a code: paste it into Claude Code at thePaste code here >prompt, and the sign-in continues from there. - For
Couldn't start the local listener that receives the browser sign-in, run the same command again. If it stops the same way, sign in with a token or API key instead of the browser. If you piped input intoclaude auth login, run it in a terminal so it can take a pasted code. - To sign in with a token or API key instead of the browser: if you use a claude.ai subscription, run
claude setup-tokenon a machine where sign-in works, then set the token it prints as theCLAUDE_CODE_OAUTH_TOKENenvironment variable on this machine. Otherwise setANTHROPIC_API_KEYto a key from the Claude Console. Authentication precedence explains how Claude Code chooses between credentials. - To get the automatic browser return back, Claude Code must be able to listen on
127.0.0.1. If it runs inside a sandbox, check that the sandbox's policy allows listening on local ports, then sign in again. If listening should work there and the notice still appears, run/feedbackso the report includes your environment details. - On versions before v2.1.305, the sign-in stopped as soon as the port could not be opened and showed no URL to sign in at. On those versions, update Claude Code and sign in again, or sign in with a token or API key instead of the browser.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
Sign-in timed out while waiting for you to continue
Sign-in timed out while waiting for you to continue. Try again.What it means. During a Claude apps gateway sign-in the gateway named the account that signed in and Claude Code asked you to confirm it, and you left that confirmation open past the sign-in's own expiry, so nothing was stored when you continued.
How to fix it
- Run
/loginagain and confirm the account before the sign-in expires.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
Anthropic profile login expired
Anthropic profile login expired · Re-authenticate your Anthropic profileLogin expired · Run /login to sign in again, or re-authenticate your Anthropic profileWhat it means. Claude Code is authenticating through an Anthropic credential profile whose saved credential has expired, and the profile has no refresh credential it can use to renew it, so each request stops locally without a retry.
How to fix it
- If the message leads with
Login expired, run/loginto sign in again. - To renew a profile that the keyless Console sign-in or the Claude Platform CLI's
ant auth loginwrote, run/loginon a machine that offers the keyless sign-in. Choose the Anthropic Console account, then Sign in with your Console account. Claude Code replaces the expired credential in that profile. - To renew a profile that another tool created, sign in again with that tool. If you choose Sign in with your Console account at
/logininstead, Claude Code leaves the profile as it is and creates an API key. - If an administrator provisioned the profile's credential, ask them to issue a new one.
- Run
/statusto confirm the active credential source and profile name. - To stop using the profile, unset
ANTHROPIC_PROFILEif you set it, then authenticate another way, such as/loginorANTHROPIC_API_KEY.
Source: Anthropic, Claude Code error reference, read on October 23, 2026.
What not to do
Most of these errors have a step that makes them worse. Each line below says what to avoid and why, and the sections above carry the source.
- Do not assume an expired token explains a
401 Invalid authentication credentials. That message means the API read the credential and rejected the account or organization behind it, so run/statusand find out which credential is active before you sign in again. - Do not sign in again expecting it to replace an approved API key. An approved
ANTHROPIC_API_KEYtakes precedence over your login, so/loginleaves it in place. Rotate the key in the Console, or unset the variable if you meant to use your subscription. - Do not keep resending a request after
Login expired. Claude Code produces that message locally and sends nothing, so the same line comes back every time until you sign in. - Do not restart a session that says
Not logged inwhen you have just signed in somewhere else. On current versions it picks that login up on its own. On macOS before v2.1.286 the message could stay put, and there a restart is the fix. - Do not pipe input into
claude auth login. It is one of the ways the browser sign-in listener stops before it starts. Run it in a terminal so it can take a pasted code. - Do not do anything about the notice beginning
The browser can't return the sign-in to Claude Code automatically. Nothing is broken: open the URL it shows, sign in, and paste the code it gives you back into Claude Code.
Running several Claude Code sessions at once
Omniscio is the desktop app we make for running many Claude Code sessions at once. Every Claude session it starts signs in one of three ways, chosen in Settings → AI & Accounts → Accounts → the Claude tab: Claude Code login, the default, which uses the login the claude command already wrote to your home directory and stores nothing of its own; Sign in to Claude, which signs in from inside the app; or Your API key, which runs the session on a key you paste. Before you chase a login error, know that a free claude.ai account is not enough for Claude Code: Anthropic's setup page names a Pro, Max, Team, Enterprise or Console account and says the free claude.ai plan does not include access, though it also lists Amazon Bedrock, Google Cloud's Agent Platform and Microsoft Foundry as other ways to run it. The features page lists the rest of the app, and the download page has the installers.
Sources
Every message, every meaning and every step on this page rests on one of these. The date beside each one is the day we read it.
- Claude Code error reference, for the ten sign-in messages and the steps under each. Read October 23, 2026.
- Troubleshoot installation and login, for the repeated-login checks. Read October 23, 2026.
- Login and authentication, for the 403 and browser sign-in failures. Read October 23, 2026.
- Not logged in or token expired, for the system clock checks and the macOS credential-storage recovery steps. Read October 23, 2026.
- Authentication, for authentication precedence, the keyless sign-in and long-lived tokens. Read October 23, 2026.
- Environment variables, for
ANTHROPIC_API_KEY,CLAUDE_CODE_OAUTH_TOKEN,ANTHROPIC_BASE_URLandANTHROPIC_PROFILE. Read October 23, 2026. - Settings reference, for the
apiKeyHelperscript and the settings files. Read October 23, 2026. - Commands, for
/login,/statusand/feedback. Read October 23, 2026. - CLI reference, for
claude auth login,claude setup-tokenand-p. Read October 23, 2026. - Run Claude Code programmatically, for the non-interactive
-pwording of these messages. Read October 23, 2026. - Advanced setup, for the accounts Claude Code requires and the other providers it runs on. Read October 23, 2026.
Common questions
Which credential is Claude Code using when I have both a login and an API key?
Run /status. An approved ANTHROPIC_API_KEY in your environment takes precedence over a saved login, which is why /login does not replace it. The status output names the active credential and, for an expired login, the account it belongs to.
Why does /login not fix my 401 error?
A 401 that reads Invalid authentication credentials means the account or organization behind your active credential was revoked, disabled or deactivated. That credential can be your saved login or an approved API key, so run /status first: rotate the key in the Console, sign in again, or ask your organization admin to restore access.
Do I need a paid plan to sign in to Claude Code?
You need more than a free claude.ai account. Anthropic's setup page names a Pro, Max, Team, Enterprise or Console account and says the free claude.ai plan does not include Claude Code access, and the same page lists Amazon Bedrock, Google Cloud's Agent Platform and Microsoft Foundry as other ways to run it.
What is the difference between a revoked token and an expired one?
A revoked token means you signed out everywhere or an admin removed your access. An expired token means the automatic refresh failed during the session. Both give way to a fresh sign-in, and /login replaces the old credential, with one exception: if you set CLAUDE_CODE_OAUTH_TOKEN, Claude Code keeps sending that value after a 401, so generate a fresh token with claude setup-token or unset the variable first.
How do I sign in without a browser?
Run claude setup-token on a machine where sign-in works, then set the token it prints as the CLAUDE_CODE_OAUTH_TOKEN environment variable, or set ANTHROPIC_API_KEY to a key from the Claude Console.
Where does Anthropic document these messages?
Anthropic keeps an error reference at code.claude.com/docs/en/errors and an install troubleshooting page at code.claude.com/docs/en/troubleshoot-install. This page quotes ten of the sign-in messages from those pages, and each section links the anchor its message and steps come from.