[BUG] Anthropic CLI Overwrites and Pins Claude Code Credentials

Resolved 💬 5 comments Opened May 20, 2026 by realprogrammersusevim Closed Jun 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] 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_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗