[BUG] Claude Code OAuth Authentication Fails - "OAuth account information not found in config"

Resolved 💬 47 comments Opened Jun 1, 2025 by hellohqd Closed Jun 23, 2025
💡 Likely answer: A maintainer (dicksontsai, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Claude Code version: 1.0.6
  • Operating System: macOS
  • Node.js version: v22.16.0
  • npm version: 10.9.2
  • Account type: Claude Max subscription
  • Network environment: Corporate network with specific routing requirements

Description

Claude Code fails to complete OAuth authentication in my network environment, consistently showing the error:

OAuth error: Failed to fetch user roles: OAuth account information not found in config

Steps to Reproduce

  1. Install Claude Code: npm install -g @anthropic-ai/claude-code
  2. Run Claude Code: claude
  3. Select theme (any option)
  4. Select login method: "2. Claude app (requires Max subscription)"
  5. Browser opens OAuth page successfully
  6. Complete authorization (shows "You're all set up for Claude Code")
  7. Return to terminal
  8. Error appears: OAuth error: Failed to fetch user roles: OAuth account information not found in config

Expected Behavior

After OAuth authorization, Claude Code should successfully authenticate and start normally.

Actual Behavior

Despite successful OAuth flow in browser, Claude Code fails to save or retrieve the authentication configuration, resulting in the error message. The browser shows "You're all set up" but the CLI cannot proceed.

Additional Context

  • The OAuth flow completes successfully in browser
  • Sometimes an authentication code is displayed to paste into Claude Code, but entering it doesn't resolve the issue
  • The error suggests the OAuth account information is not being properly saved to the config file
  • Message "Creating API key for Claude Code..." appears briefly before the error

Troubleshooting Attempted

  1. Complete uninstall and cleanup:

``bash
npm uninstall -g @anthropic-ai/claude-code
rm -rf ~/.claude
rm -rf ~/.npm-global/lib/node_modules/@anthropic-ai/
rm -rf ~/Library/Application\ Support/ClaudeCode
npm cache clean --force
``

  1. Tried both login methods (Claude app & Anthropic Console) - same error
  2. Tested with different browsers (Safari, Chrome)
  3. Fresh install on clean system

Possible Cause

The issue appears to be related to Claude Code's OAuth callback handling or configuration file creation/reading after successful browser authentication.

Related Issues

Similar authentication issues reported by other users with Max subscriptions, suggesting this might be a broader issue with the OAuth implementation.

View original on GitHub ↗

47 Comments

dicksontsai collaborator · 1 year ago

Some things you can try:

  1. Remove ~/.claude.json, not just ~/.claude.
  2. Can you check if your network allows https://api.anthropic.com? Claude Code makes a couple calls there for authentication.
  3. Can you try downloading and logging in to a newer version (v1.0.11, for example)
hellohqd · 1 year ago
Some things you can try: 1. Remove ~/.claude.json, not just ~/.claude. 2. Can you check if your network allows https://api.anthropic.com? Claude Code makes a couple calls there for authentication. 3. Can you try downloading and logging in to a newer version (v1.0.11, for example)

Update: Even single character commands like 'h' or 'pwd' result in the same error:
"API Error: Cannot convert argument to a ByteString because the character at index 0 has a value of 8217"

This happens with ANY input, suggesting a critical bug in Claude Code's character encoding handling.

Environment details:

  • macOS Terminal works fine (echo "test" works)
  • Using API key authentication (Max member OAuth also failed)
  • Error persists after removing all config files
  • Version: [run claude --version to check]
dicksontsai collaborator · 1 year ago

There seems to be a different error here related to your input.

The character at index 0 with value 8217 is a right single quotation mark (' - Unicode U+2019). This is a "smart quote" or "curly quote" that's commonly inserted by word processors, rich text editors, or when copying text from formatted documents.

Can you share a screenshot of the API Error and also the result of /status?

hellohqd · 1 year ago

Here's the screenshot showing both the API error and /status result:

<img width="570" alt="Image" src="https://github.com/user-attachments/assets/a06de5bd-aad1-4807-bf1a-dc811a6d2f80" />

Key observations:

  • Error occurs when typing single character 'h'
  • Claude Code Status: v1.0.11
  • Auth Token: none (using API Key authentication instead)
  • API Key: ANTHROPIC_API_KEY (environment variable)
  • Model: claude-sonnet-4-20250514
  • Working Directory: /Users/moment

The error happens with ANY input, suggesting the issue is in Claude Code's input handling before it reaches the API.

dicksontsai collaborator · 1 year ago

Ok I think there's something wrong with how the OAuth was saved. Can you try:

  1. security delete-generic-password -a $USER -s "Claude Code-credentials"
  2. Run /login again.

If that still doesn't work, I don't have many remaining ideas...

hellohqd · 1 year ago

Thank you for the suggestion! It helped uncover the root cause:

What I discovered:

  1. security delete-generic-password returned "item could not be found" - meaning OAuth credentials were never saved to keychain
  2. This explains why authentication never persists

Testing OAuth flow:

  • OAuth browser flow completes successfully
  • But Claude Code fails with: "Failed to fetch user roles: Request failed with status code 403"
  • Since user roles can't be fetched, credentials are never saved to keychain
  • This creates the authentication loop

Two separate bugs identified:

  1. OAuth Bug: 403 error when fetching user roles (prevents Max subscription login)
  2. Input Bug: ByteString encoding error with ANY input after authentication fails

The OAuth credentials not being in keychain is a symptom, not the cause - they can't be saved because the user role fetch fails with 403.

Environment: macOS, Max subscription, v1.0.11

dicksontsai collaborator · 1 year ago

You may be running into the following issue: https://www.anthropic.com/supported-countries

Thanks for your patience in debugging this with me.

dicksontsai collaborator · 1 year ago

Actually, based on the fact that you see "fetching user roles", you are likely going through the "Anthropic Console account" flow instead of the "Claude account with subscription" flow. Ensure that you are selecting "Claude account with subscription" if you want to use your Claude Max plan.

floresfreddy · 1 year ago

Fixed my issue. Thx

darkguy2008 · 1 year ago

Sorry to reopen the issue but I am getting this right now, maybe related to the outage that you guys had today:

claude -p hi
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid OAuth token. The provided token was not found or is malformed."}}

I am trying to use my claude code account. I've already removed the .claude files, reinstalled the npm package and logged out & back in, same deal.

Any ideas?

rnmp · 1 year ago

Must be an outage. I just encountered the same.

MintCollector · 1 year ago

Same

kootenpv · 1 year ago

Same here, time to hit the hay

Neiso · 1 year ago

Same

MikeChongCan · 1 year ago

same

tansanDOTeth · 1 year ago

Hopping on the "same" bandwagon

5AMLab · 1 year ago

same me too

agamm · 1 year ago

same :)

yr99jparkin · 1 year ago

Same

illusivejosiah · 1 year ago

Same

lsgrep · 1 year ago

Same

cameronembling · 1 year ago

Same

theprestonian · 1 year ago

seems to be working for me now

cameronembling · 1 year ago

When your dealers phone stops working

0xDAEF0F · 1 year ago

lmaoooo all bros here

time to hit the gym

sumhwang · 1 year ago

same here. I thought it was because I installed both the local and global versions of Claude Code by mistake, but it seems to be a bug.

rnmp · 1 year ago

<img width="681" height="140" alt="Image" src="https://github.com/user-attachments/assets/cc087959-e7cf-43a9-98b1-6a17ffe6989e" />

nidty719 · 1 year ago

same issue here

Crohnos · 1 year ago

I'm having the same issue with the exact same error message. Haven't logged in for a week... Definitely on Anthropic's side.

mak-john · 1 year ago

same issue.

karinabarinova · 1 year ago

same issue.

ifnk · 1 year ago

same please fix it

samuelho-dev · 1 year ago

Facing the same issue as of today.

dicksontsai collaborator · 1 year ago

We paged our accounts oncall and are trying to address the issue ASAP.

k-r-a-s-s · 1 year ago

same issue

Crohnos · 1 year ago

Why hasn't Anthropic opened an issue I wonder? It's not showing as down on the status page...

https://status.anthropic.com/

a-r-d · 1 year ago

ok its an outage then :)

grep-ir · 1 year ago

Phew I thought it was just me

theprestonian · 1 year ago

maybe i'm just lucky, but i re-authenticated and it's working now. Accessing via Claude Pro subscription in WSL

Hazqeel09 · 1 year ago

same here

feathars91 · 1 year ago

its still happening right?

yr99jparkin · 1 year ago

back up now

tavik000 · 1 year ago

Same error here, happy to see I am not alone, and we are both happen on the same day.

dicksontsai collaborator · 1 year ago

The incident should now be resolved. Thank you for your patience.

\- Claude Code oncall

jhutan-acko · 1 year ago

Still facing this issue. Have tried:

  1. security delete-generic-password -a $USER -s "Claude Code-credentials"
  2. Run /login again.

<img width="711" height="242" alt="Image" src="https://github.com/user-attachments/assets/a89b94ca-ddf6-4089-9425-c839d2130393" />

iamshouvikmitra · 11 months ago

Facing this issue again today!

github-actions[bot] · 11 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.