Skip to content

[Bug/Documentation] 'Organization has been disabled' error when ANTHROPIC_API_KEY overrides Max/Pro subscription #8327

Description

@Toowiredd

[Bug/Documentation] "Organization has been disabled" error when ANTHROPIC_API_KEY overrides Max/Pro subscription

Problem Description

Users with valid Claude Pro/Max subscriptions are receiving "This organization has been disabled" error when using Claude Code CLI, despite having active subscriptions that work fine on claude.ai.

Root Cause

When an ANTHROPIC_API_KEY environment variable is set (especially from a previously disabled organization), it overrides the user's valid Max/Pro subscription authentication, causing Claude Code to attempt authentication with the disabled API key instead of the active subscription.

Steps to Reproduce

  1. Have a valid Claude Max/Pro subscription
  2. Have ANTHROPIC_API_KEY environment variable set to a key from a disabled organization
  3. Run claude --print "test" or npx @anthropic-ai/claude-code@latest --print "test"
  4. Receive error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"This organization has been disabled."}}

Solution

Remove or unset the ANTHROPIC_API_KEY environment variable:

# Temporary fix
unset ANTHROPIC_API_KEY
claude --print "test"  # Now works!

# Permanent fix - remove from shell config
# Remove any line like: export ANTHROPIC_API_KEY="sk-ant-..."

Evidence

Test Results

# With API key from disabled org
$ export ANTHROPIC_API_KEY="sk-ant-api03-[disabled-key]"
$ claude --print "What is 2+2?"
API Error: 400 "This organization has been disabled"

# Without API key (using Max subscription)
$ unset ANTHROPIC_API_KEY
$ claude --print "What is 2+2?"
4  # Works perfectly!

Impact

This affects users who:

  • Have valid Pro/Max subscriptions
  • Previously used API keys from organizations (work, school, etc.)
  • Have those organizations now disabled
  • Don't realize the old API key overrides their personal subscription

Suggested Improvements

  1. Better Error Message: Instead of "This organization has been disabled", show:

    "API key from disabled organization detected.
     You have a valid Max subscription.
     Run 'unset ANTHROPIC_API_KEY' to use your subscription instead."
    
  2. Add Warning: When Claude Code detects both subscription and API key:

    "Warning: ANTHROPIC_API_KEY is overriding your Max subscription.
     Remove the environment variable to use your subscription benefits."
    
  3. Update Documentation: Add a troubleshooting section specifically for this scenario in:

  4. Add --use-subscription Flag: Allow explicit override:

    claude --use-subscription --print "test"  # Ignores ANTHROPIC_API_KEY

Additional Context

  • This is not a bug in the traditional sense - it's documented behavior that API keys override subscriptions
  • However, the error message is misleading and doesn't help users understand the actual problem
  • Many users may have old API keys in their environment from previous projects/employers
  • The current documentation doesn't explicitly warn about disabled organization keys

Environment

  • OS: Windows 10 (Git Bash/MINGW64)
  • Claude Code Version: 1.0.128
  • Subscription: Claude Max (Individual)
  • Issue discovered: September 29, 2025

Related Issues

This may explain some cases in:

Reproducible Example

I've created a complete test suite showing this issue and the solution:
https://gist.github.com/[would-create-gist-with-full-test-results]


I discovered this after extensive debugging and wanted to document it for others experiencing the same confusing error. Happy to provide more details or help test fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:authbugSomething isn't workingenhancementNew feature or requesthas reproHas detailed reproduction stepsoncallplatform:windowsIssue specifically occurs on Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions