claude-code - 💡(How to fix) Fix [BUG] Anthropic CLI Overwrites and Pins Claude Code Credentials

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

  • Debug Logs: [ERROR] API error (attempt 1/11): Access token at ~/.config/anthropic/credentials/default.json has expired and no refresh is available (even after attempting to re-login).

Root Cause

Claude Code can become "stuck" using API Usage Billing even when the user has an active Claude Pro subscription. This occurs because Claude Code shares the ~/.config/anthropic configuration directory with the Anthropic CLI.

Code Example

- Debug Logs: `[ERROR] API error (attempt 1/11): Access token at ~/.config/anthropic/credentials/default.json` has expired and no refresh is available (even after attempting to re-login).
- UI Banner: Shows "API Usage Billing · [Org Name]" despite the user being logged into an account with a Pro subscription.
- Auth Status: `Profile: credentials-file · user_oauth · profile default` (does not indicate that the organization is being overridden by a local config file).
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Claude Code can become "stuck" using API Usage Billing even when the user has an active Claude Pro subscription. This occurs because Claude Code shares the ~/.config/anthropic configuration directory with the Anthropic CLI.

If the Anthropic CLI has created a configuration file at ~/.config/anthropic/configs/default.json with a hardcoded organization_id (e.g., from an "Individual Org" used during testing), Claude Code will honor that pinned organization ID. Crucially, running claude auth login or claude auth logout does not always clear or update this pinned organization_id, leading to a state where the user is logged in with the correct email but routed to the wrong organization/billing path.

In my case, I briefly installed the CLI to try using it for a script, and that alone borked my Claude Code installation in a way that logging in and out could not fix.

What Should Happen?

  1. Clearer Auth Logic: claude auth login should explicitly prompt for organization selection if multiple organizations are detected, or it should automatically prioritize organizations with an active Claude Pro subscription.
  2. Config Overwrite: Running claude auth login --claudeai should overwrite or clear any hardcoded organization_id in ~/.config/anthropic/configs/default.json that conflicts with the subscription-capable organization.

Error Messages/Logs

- Debug Logs: `[ERROR] API error (attempt 1/11): Access token at ~/.config/anthropic/credentials/default.json` has expired and no refresh is available (even after attempting to re-login).
- UI Banner: Shows "API Usage Billing · [Org Name]" despite the user being logged into an account with a Pro subscription.
- Auth Status: `Profile: credentials-file · user_oauth · profile default` (does not indicate that the organization is being overridden by a local config file).

Steps to Reproduce

  1. Install the Anthropic CLI (I used the recommended native install) and log into a "Default/Individual" organization that does not have a Pro subscription.
  2. Verify that ~/.config/anthropic/configs/default.json now contains a hardcoded organization_id.
  3. Open Claude Code and observe that it uses the pinned organization and defaults to API Usage Billing.
  4. Attempt to fix by running claude auth logout and claude auth login.
  5. Observe that even after a successful login, the ~/.config/anthropic/configs/default.json file remains pinned to the old organization ID, keeping the user stuck on API billing.
  6. (Fix requires manually deleting ~/.config/anthropic/configs/default.json).

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.145 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING