Skip to content

Anthropic OAuth token spontaneously expires/fails to refresh #363

@joelkehle

Description

@joelkehle

Anthropic OAuth token spontaneously expires/fails to refresh

Environment

  • Clawdbot version: 2026.1.5-3
  • OS: macOS Tahoe 26.1
  • Auth mode: OAuth (anthropic:default with mode: "oauth")

Description

The Anthropic OAuth token randomly fails to refresh without any user action. The error appears spontaneously:

Error: Error: Error: OAuth token refresh failed for anthropic: Failed to refresh OAuth token for anthropic. Please try again or re-authenticate.

This requires running pnpm clawdbot update to reset the OAuth, which is disruptive and happens frequently enough to be a significant pain point.

Steps to Reproduce

  1. Configure clawdbot with Anthropic OAuth authentication
  2. Use normally
  3. Wait (unclear trigger - happens spontaneously)
  4. OAuth stops working with the refresh error

Expected Behavior

  • OAuth token refreshes automatically in the background
  • Or graceful degradation with clear user prompt to re-auth
  • Ideally: persistent auth that doesn't randomly break

Actual Behavior

  • Token refresh fails unpredictably
  • Requires manual intervention (clawdbot update) to fix
  • No clear trigger or warning before failure

Config (relevant section)

{
  "auth": {
    "profiles": {
      "anthropic:default": {
        "provider": "anthropic",
        "mode": "oauth"
      }
    }
  }
}

Questions for debugging

  • Is there a token expiry log or timestamp I can check?
  • Are there specific conditions that trigger this (time-based, request-based, network-based)?
  • Is there a way to manually refresh without running update?

Frequency

~4 times in the first 24 hours of use. Highly disruptive.

Log entries

2026-01-07T03:49:35.410Z - [gws] ⇄ res ✗ chat.send 316ms 
  errorCode=UNAVAILABLE 
  errorMessage=Error: OAuth token refresh failed for anthropic: Failed to refresh OAuth token for anthropic. Please try again or re-authenticate.

2026-01-07T03:52:15.491Z - [gws] ⇄ res ✗ chat.send 393ms 
  errorCode=UNAVAILABLE 
  errorMessage=Error: OAuth token refresh failed for anthropic: Failed to refresh OAuth token for anthropic. Please try again or re-authenticate.

Note: Two failures within 3 minutes of each other, suggesting the token was already bad and multiple requests hit it before the user could re-auth.

Workaround

Running pnpm clawdbot update resets the OAuth and fixes the issue temporarily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions