claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Anthropic API Error: OAuth token missing user:profile scope

Open amihos opened this issue 1 year ago • 17 comments

Bug Description

/usage ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Settings: Status Config Usage (tab to cycle)

Error: Failed to load usage data: {"type":"error","error":{"type":"permission_error","message":"OAuth token does not meet scope requirement user:profile","details":{"error_visibility":"user_facing"}},"request_id":"req_011CVJ9dSmiBcFVi2Zo78LBE"}

Environment Info

  • Platform: linux
  • Terminal: wsl-Ubuntu
  • Version: 2.0.47
  • Feedback ID:

Errors

[{"error":"Error: Plugin component file not found: /home/huso/.claude/plugins/marketplaces/anthropic-agent-skills/algorithmic-art for example-skills\n    at Jf1 (/$bunfs/root/claude:1726:8950)\n    at Jf1 (/$bunfs/root/claude:1726:13059)\n    at Mf1 (/$bunfs/root/claude:1726:5600)\n    at async <anonymous> (/$bunfs/root/claude:1726:14042)\n    at async hvI (/$bunfs/root/claude:1726:17416)\n    at async A (/$bunfs/root/claude:1726:18136)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-19T23:39:47.829Z"},{"error":"Error\n    at wO (/$bunfs/root/claude:59:1143)\n    at <anonymous> (/$bunfs/root/claude:64:10080)\n    at emit (node:events:92:22)\n    at endReadableNT (internal:streams/readable:862:50)\n    at processTicksAndRejections (native:7:39)\n    at request (/$bunfs/root/claude:66:2147)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-19T23:39:49.603Z"},{"error":"Error\n    at wO (/$bunfs/root/claude:59:1143)\n    at <anonymous> (/$bunfs/root/claude:64:10080)\n    at emit (node:events:92:22)\n    at endReadableNT (internal:streams/readable:862:50)\n    at processTicksAndRejections (native:7:39)\n    at request (/$bunfs/root/claude:66:2147)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-19T23:39:49.604Z"},{"error":"Error: Tool mcp__openmemory__openmemory_query not found\n    at AhI (/$bunfs/root/claude:1341:507)\n    at C8 (/$bunfs/root/claude:101:19666)\n    at f5 (/$bunfs/root/claude:103:42843)\n    at sT (/$bunfs/root/claude:103:38376)\n    at H0 (/$bunfs/root/claude:103:38304)\n    at OV (/$bunfs/root/claude:103:38158)\n    at rT (/$bunfs/root/claude:103:35233)\n    at wD (/$bunfs/root/claude:101:4818)\n    at OW (/$bunfs/root/claude:103:32479)\n    at <anonymous> (/$bunfs/root/claude:107:1829)","timestamp":"2025-11-19T23:39:51.388Z"},{"error":"Error: Tool mcp__openmemory__openmemory_store not found\n    at AhI (/$bunfs/root/claude:1341:507)\n    at C8 (/$bunfs/root/claude:101:19666)\n    at f5 (/$bunfs/root/claude:103:42843)\n    at sT (/$bunfs/root/claude:103:38376)\n    at H0 (/$bunfs/root/claude:103:38304)\n    at OV (/$bunfs/root/claude:103:38158)\n    at rT (/$bunfs/root/claude:103:35233)\n    at wD (/$bunfs/root/claude:101:4818)\n    at OW (/$bunfs/root/claude:103:32479)\n    at <anonymous> (/$bunfs/root/claude:107:1829)","timestamp":"2025-11-19T23:39:51.624Z"},{"error":"Error: Tool mcp__openmemory__openmemory_store not found\n    at AhI (/$bunfs/root/claude:1341:507)\n    at C8 (/$bunfs/root/claude:101:19666)\n    at f5 (/$bunfs/root/claude:103:42843)\n    at sT (/$bunfs/root/claude:103:38376)\n    at H0 (/$bunfs/root/claude:103:38304)\n    at OV (/$bunfs/root/claude:103:38158)\n    at rT (/$bunfs/root/claude:103:35233)\n   

Note: Error logs were truncated.

amihos avatar Nov 19 '25 23:11 amihos

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/11102

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Nov 20 '25 00:11 github-actions[bot]

TLDR Fix

@amihos Just log out and back in again (make sure you are running the latest version) :

/logout

If that doesn't work, do this: https://github.com/anthropics/claude-code/issues/11985#issuecomment-3695455995

(essentially also logout, but from the API)


Yeah I had this same issue when typing /usage in the cli and just figured it out.

I'm am running the latest version. It appears to be session issue:

 Error: Failed to load usage data: 
 {"type":"error","error":{"type":"permission_error","message":"OAuth token does not meet 
 scope requirement user:profile","details":{"error_visibility":"user_facing"}},"request_id
 ":"req_011CVnefk358KyybJ8QPHUVq"}
Image

I tried a bunch of things and finally, logging out and back in again worked. So I'm guessing a new permission was added to accounts but it is only applied when you log in, so if somebody has a session from before then it doesn't have the needed permission applied.

:tada: Image


aside: #11102 is not a dupe as they are complaining about an unexplained usage issue and permissions problem on the website, not the cli. Although the second part is likely related.

Strangely, during my testing of this promblem and not actually making Claude inference requests for the last hour or doing anything other than running /usage. My usage went up by 1% (from 13 to 14%, see screenshots which were taken within a short time) which is similar to what the other user in #11102 was complaining about.

Image

Perhaps there are tokens being consumed simply by launching Claude Code or running /usage?

gerrywastaken avatar Dec 05 '25 01:12 gerrywastaken

Logging out did not fix this for me v2.0.75

MisterBiggs avatar Dec 22 '25 02:12 MisterBiggs

@MisterBiggs I found that I had to unset my CLAUDE_CODE_OAUTH_TOKEN environment variable to clear this problem

goofballLogic avatar Dec 24 '25 09:12 goofballLogic

My ~/.zshrc file now has all of these

unset ANTHROPIC_BASE_URL
unset ANTHROPIC_AUTH_TOKEN
unset CLAUDE_CODE_OAUTH_TOKEN

codenamezjames avatar Dec 29 '25 05:12 codenamezjames

Confirming this issue on version 2.0.76 (macOS).

Steps tried:

  • Ran claude setup-token - completed successfully but error persists
  • Still getting: OAuth token does not meet scope requirement user:profile

Workaround to try: Based on @gerrywastaken's comment, will try /logout and logging back in instead of setup-token.

Note: setup-token appears insufficient to fix this - requires full logout/login cycle to obtain token with correct scopes.

dglassow avatar Dec 31 '25 03:12 dglassow

The issue is when you use claude setup-token after a regular login.

To reproduce:

  • Regular (web-flow) log onto Claude Code
  • Check /usage - it will display
  • Mint a headless/long-living token with claude setup-token
  • Check /usage - you will get the OAuth permission error

Tldr: Long-living token has scopes=["user:inference"], which means OAuth cannot be used to retrieve remaining quota. To make OAuth work, you must obtain a token that includes user:profile, which is provided during the initial Claude Code login flow

Ziyad avatar Jan 15 '26 08:01 Ziyad

Im still facing this issue. Logout and login didnt fix it. Unsetting the env var fixed it.

shenron0101 avatar Jan 29 '26 05:01 shenron0101

Related Bug: OAuth Token Not Linked to Max Subscription

This OAuth scope issue is part of a broader OAuth → Subscription linking problem affecting Max subscribers since January 2026.

My Environment

  • Claude Code Version: 2.1.27 (CLI)
    • OS: Ubuntu 25.10 (native Linux)
      • Subscription: Claude Max (active)

Symptoms I Experienced

  1. "Osmosing/Scampering 0 tokens" - requests silently rejected
    1. After checking ~/.claude.json: hasExtraUsageEnabled: false despite active Max subscription

Root Cause Analysis

The OAuth authentication pipeline has multiple failure points:

  1. Token generation succeeds ✓
    1. Scope assignment may be incomplete (this issue - missing user:profile)
    1. Subscription verification fails or returns incorrect data ✗
    1. hasExtraUsageEnabled: false is set by default ✗

Workaround

# Clean credentials completely
rm -f ~/.claude.json
rm -rf ~/.claude

# Also unset environment variables if present
unset ANTHROPIC_BASE_URL
unset ANTHROPIC_AUTH_TOKEN
unset CLAUDE_CODE_OAUTH_TOKEN

# Re-authenticate
claude

How to Verify

cat ~/.claude.json | grep -E "(subscriptionType|hasExtraUsageEnabled|rateLimitTier)"

If hasExtraUsageEnabled: false appears after re-authentication, it's the backend bug.

Related Issues

  • #17966 - Main bug report with detailed analysis
    • #6008 - "0 tokens" symptom
      • #20756 - OAuth issues in WSL2 This appears to be a systemic backend issue where the OAuth → Subscription linking pipeline is failing for valid Max subscribers.

ghcreative869 avatar Jan 31 '26 18:01 ghcreative869

Still reproducible on v2.1.37 (Linux arm64, Anthropic API). Closing my duplicate #24200 in favor of this one.

jasjisdo avatar Feb 08 '26 15:02 jasjisdo

Clarification: There is no workaround for setup-token users.

The suggested fixes (/logout + re-login, unset CLAUDE_CODE_OAUTH_TOKEN) all bypass setup-token entirely and fall back to the web-based OAuth flow. That defeats the purpose of setup-token, which exists for headless/CI environments or setups without a browser.

The root cause is clear: claude setup-token requests scope=user:inference only. The /usage endpoint requires user:profile. This is a bug in setup-token itself — it needs to request user:profile as an additional scope.

Until this is fixed, anyone relying on long-lived tokens from setup-token simply cannot use the Usage tab in /status.

jasjisdo avatar Feb 08 '26 15:02 jasjisdo

Still happening with long lived sessions. After doing /logout and logging in again, I can see /usage.

theholy7 avatar Feb 10 '26 13:02 theholy7

Neither logout/login nor setup-token doesn't work for me. Using the latest version 2.1.42

aprudnikoff avatar Feb 16 '26 08:02 aprudnikoff

Issue is still present in version 2.1.47

stevensacks avatar Feb 19 '26 06:02 stevensacks

I am going nuts with this issue. Its there and unfixable.

AfterRealm avatar Feb 28 '26 21:02 AfterRealm

I resolved it by logging out completely, deleting the oauth token from the Claude settings, and logging back in. The token I got from logging in now has the missing scopes.

stevensacks avatar Mar 01 '26 09:03 stevensacks

This was fixed in Claude Code 2.1.323, so we're closing this issue. If you disagree, let us know here and we can re-open it. Thanks for reporting!

bpasero-ant avatar Nov 29 '26 17:11 bpasero-ant