[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
- Have a valid Claude Max/Pro subscription
- Have
ANTHROPIC_API_KEY environment variable set to a key from a disabled organization
- Run
claude --print "test" or npx @anthropic-ai/claude-code@latest --print "test"
- 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
-
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."
-
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."
-
Update Documentation: Add a troubleshooting section specifically for this scenario in:
-
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.
[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_KEYenvironment 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
ANTHROPIC_API_KEYenvironment variable set to a key from a disabled organizationclaude --print "test"ornpx @anthropic-ai/claude-code@latest --print "test"API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"This organization has been disabled."}}Solution
Remove or unset the
ANTHROPIC_API_KEYenvironment variable:Evidence
Test Results
Impact
This affects users who:
Suggested Improvements
Better Error Message: Instead of
"This organization has been disabled", show:Add Warning: When Claude Code detects both subscription and API key:
Update Documentation: Add a troubleshooting section specifically for this scenario in:
Add
--use-subscriptionFlag: Allow explicit override:Additional Context
Environment
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.