Skip to content

Anthropic Claude Pro/Max OAuth login fails with 429 on token exchange #18329

@dotCipher

Description

@dotCipher

Description

opencode auth login -p anthropic -m "Claude Pro/Max" consistently fails during the OAuth code exchange step with 429 Too Many Requests from https://console.anthropic.com/v1/oauth/token.

This is not just a generic Failed to authorize UI problem; with local debug logging enabled in the Anthropic auth plugin, the underlying failure is:

[opencode-anthropic-auth] OAuth exchange failed: status=429 statusText=Too Many Requests headers={...} body={
  "error": {
    "type": "rate_limit_error",
    "message": "Rate limited. Please try again later."
  }
}

I can reproduce this across multiple Anthropic accounts, which makes it look more like a flow-level / client-level / IP-level throttle than an account-specific Max-plan problem.

Environment

  • OpenCode version: 1.2.20
  • OS: macOS
  • Provider: anthropic
  • Login method: Claude Pro/Max

Steps to reproduce

  1. Run:
    opencode auth login -p anthropic -m "Claude Pro/Max" --print-logs --log-level DEBUG
  2. Open the provided claude.ai/oauth/authorize URL in the browser.
  3. Complete login successfully in Claude.
  4. Paste the returned authorization code back into OpenCode.
  5. Observe Failed to authorize.

What is happening underneath

The browser authorization step succeeds and returns a code.

The failure happens on the follow-up token exchange to:

  • POST https://console.anthropic.com/v1/oauth/token

The plugin currently collapses that HTTP failure into a generic Failed to authorize message.

Related behavior

Earlier in the same session, Anthropic OAuth refresh was also failing for prompt traffic with:

Error: Token refresh failed: 429

So both fresh login and refresh appear to be failing on the Anthropic OAuth/token path.

Notes

  • Anthropic status page was nominal at the time.
  • We also tested changing the outgoing User-Agent for Anthropic requests locally, but the 429 still occurred.
  • The response did not include a Retry-After header or obvious Anthropic rate-limit reset metadata, only generic front-door headers.

Request

It would help a lot if OpenCode could:

  1. Surface the real OAuth exchange status/body instead of only Failed to authorize.
  2. Clarify whether this Anthropic OAuth flow is still supported / expected to work for Claude Pro/Max.
  3. Potentially make the Anthropic auth/user-agent behavior configurable for debugging.

If helpful, I can provide the exact debug patch used to expose the hidden exchange error.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions