Skip to content

Token refresh fails with 400 on initial prompt (Anthropic Max / Claude Opus 4.6) #16210

@vitorpavani

Description

@vitorpavani

Description

After sending the initial prompt, the system occasionally returns:

Error: Token refresh failed: 400

A couple of seconds later, the request goes through successfully.

Environment

  • Model: Claude Opus 4.6 (anthropic/claude-opus-4-6)
  • Subscription: Anthropic Max
  • Behavior: Intermittent — likely occurs when the auth token has expired and needs refreshing

Steps to Reproduce

  1. Start a new OpenCode session with Claude Opus 4.6 via Anthropic Max
  2. Send a prompt (particularly after the session has been idle / token has expired)
  3. Observe Token refresh failed: 400 error
  4. Wait ~2 seconds — the request then succeeds on retry

Expected Behavior

Token refresh should succeed silently without surfacing an error to the user.

Actual Behavior

When the token needs refreshing, the first refresh attempt fails with a 400 status. The automatic retry succeeds shortly after. This does not happen on every prompt — only when the system needs to refresh an expired token.

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