#Oauth Token Refresh Failed

1 messages Β· Page 1 of 1 (latest)

strong sapphireBOT
#

I see Jordan VH is hitting an OAuth token refresh failure for Anthropic. This is a FailoverError, meaning Clawdbot tried to use backup credentials but they also failed.

Quick guidance for Jordan:

  1. Re-authenticate with Anthropic β€” the token refresh completely failed, so manual re-auth is needed
  2. Check API keys β€” ensure the Anthropic API key is still valid and hasn't been rotated or revoked
  3. Gateway restart β€” after re-auth, restart the gateway to pick up fresh credentials

Peter, if you want me to investigate:

  • Does this happen often? Could indicate rate limiting or key issues
  • Want me to search docs for known OAuth refresh patterns?

The error channel name (#Oauth Token Refresh Failed) suggests this is already a dedicated space for these issues β€” good setup! 🦐

fair eagle
#

how do I refresh it

#

@strong sapphire

strong sapphireBOT
# fair eagle <@1457407575476801641>

Jordan's pinging me about the OAuth failure. Since this is a support question in a non-#help channel, I should be concise and direct:


@Jordan VH β€” that error means both primary and backup tokens failed to refresh. Here's what to do:

  1. Re-authenticate Anthropic in your config: clawdbot configure anthropic
  2. Verify your API key hasn't been revoked in the Anthropic console
  3. Restart the gateway after re-auth: clawdbot gateway restart

If the key was rotated, the old one will be expired and Clawdbot can't refresh it β€” fresh auth fixes this.


Peter β€” this is the second OAuth refresh error I'm seeing today. Worth noting in the FAQ or docs as a common troubleshooting step? The re-auth flow is documented but users don't always find it when hitting this error.

fair eagle
#

max@Maxs-Mac-mini ~ % clawdbot configure anthropic
error: too many arguments for 'configure'. Expected 0 arguments but got 1.

strong sapphireBOT
#

Peter β€” I should verify: does clawdbot configure support provider-specific arguments at all, or is it purely interactive? The error suggests no, but I want to make sure I'm giving Jordan correct guidance.

fair eagle
#

I want to login and use my claude max plan not an api key

strong sapphireBOT
# fair eagle I want to login and use my claude max plan not an api key

Ah, that's different! Jordan wants Claude Max OAuth (the subscription login), not an API key.

OAuth token refresh failures mean the OAuth session itself expired, not just an API key issue.

For OAuth/Claude Max:

  1. The OAuth token needs to be refreshed via the proper OAuth flow
  2. This may require deleting the existing OAuth session and re-authenticating

Peter β€” I need clarification here. What's the proper way to re-authenticate Claude Max/OAuth for Anthropic in Clawdbot? Is there a specific command or flow for OAuth vs API key?

Jordan can't just run clawdbot configure and type an API key β€” that's for API key auth. OAuth requires a different re-auth flow.

Should I point Jordan to docs, or do you have the CLI command for OAuth re-auth handy?

fair eagle
#

how do I login to claude again in clawdbot

strong sapphireBOT
# fair eagle how do I login to claude again in clawdbot

Good question, Jordan. Let me verify the exact CLI command for OAuth re-authentication β€” I want to make sure I give you the right one rather than guessing.

@Peter β€” What's the CLI command to re-authenticate Claude Max OAuth in Clawdbot? Is it clawdbot login anthropic or something else? I know configure is for API keys, but OAuth needs its own flow.

Jordan needs the proper re-auth command so he can get his Claude Max session back.

mint ember
#

@fair eagle did you figure this out?

strong sapphireBOT
# mint ember <@828140448283099146> did you figure this out?

This looks like an OAuth token refresh issue with Anthropic. The error message is actually pretty clear on what to do β€” the token refresh failed and the user needs to re-authenticate.

Quick fix: The user needs to run clawdbot configure anthropic and re-authenticate with their Anthropic account.

Why this happens:

  • OAuth tokens have expiration dates
  • If Clawdbot can't refresh the token automatically (e.g., refresh token expired or was revoked), you'll see this error
  • The most common cause is the user revoked access in their Anthropic settings, or the token sat unused for too long

If re-authenticating doesn't work:

  1. Check they're using the correct Anthropic account
  2. Make sure there are no corporate SSO restrictions blocking API access
  3. Verify the Anthropic API is actually available (check status.anthropic.com)

The error message has the right answer baked in β€” "Please try again or re-authenticate" is the path forward here. 🦐

fair eagle
strong sapphireBOT
mint ember
#

I’ve logged out/in of Claude code, reinstalled clawdbot, I simply cannot get anything back from my bot. Only:

HTTP 401: authentication_error: Invalid bearer token

strong sapphireBOT
# mint ember I’ve logged out/in of Claude code, reinstalled clawdbot, I simply cannot get any...

That's a different beast β€” 401 "Invalid bearer token" means the token itself is corrupted or wrong, not just expired.

A few questions to narrow this down:

  1. Is this with Anthropic specifically? The error says "Invalid bearer token" β€” which provider is this hitting?

  2. Fresh install or was it working before? Did this start after the reinstall, or was it broken before too?

  3. Check your config: Run clawdbot config get (or look at ~/.clawdbot/config.json5) and verify the API key looks correct (no extra characters, proper format).

  4. Try reconfiguring from scratch:

    clawdbot configure list  # see what's configured
    clawdbot configure remove <provider>
    clawdbot configure <provider>  # re-add fresh
    
#
  1. If it's Anthropic specifically: Make sure you're using the Anthropic API key format (starts with sk-ant-api...) not an Anthropic consumer account email/password.

The reinstall shouldn't have touched your config in ~/.clawdbot/ β€” if that file got corrupted somehow, removing and re-adding the provider is the cleanest fix. 🦐

mint ember
#

It’s anthropic and I’m trying to setup via oauth using setup-key

#

And it’s a fresh install, never worked. Just following the wizard

strong sapphireBOT
# mint ember It’s anthropic and I’m trying to setup via oauth using setup-key

Ah, that's the issue then β€” setup-keys are one-time use only.

If that key was already redeemed (even partially/failed), it won't work again. You need a fresh setup-key from Anthropic.

To get a new one:

  1. Go to your Anthropic dashboard β†’ Settings β†’ API Keys (or wherever setup-keys are generated for OAuth)
  2. Create a new setup-key
  3. Run clawdbot configure anthropic and paste in the new key

If you already tried multiple times with the same key: Each failed attempt still consumes the key. You'll definitely need a fresh one.

This is a common gotcha with setup-keys β€” they look like they should work until you realize they're single-use. Let me know if a new key fixes it! 🦐

#

Ah, "never worked" on a fresh install changes things!

If the wizard never completed successfully, a few things to check:

  1. Setup-key source: Did you generate the setup-key in the correct Anthropic organization/account? Make sure you're looking at the right place.

  2. Try a regular API key instead: Setup-keys can be finicky. If you have an API key (starts with sk-ant-api...), you can use that directly:

    clawdbot configure anthropic
    # paste the full API key instead of setup-key
    
  3. Wizard fresh start: Sometimes the wizard state gets stuck. Try:

    rm -rf ~/.clawdbot/data/wizard.json  # reset wizard state
    clawdbot wizard
    
#
  1. Check the setup-key validity: Is it possible the key was generated but somehow malformed? Try creating a brand new one in Anthropic's console.

The 401 on a fresh install points to either the key being bad, or the wizard writing garbage to config. Swapping to a regular API key (if you have one handy) is the fastest test. 🦐

fair eagle
#

how do I reauthenticate my claude max accout in clawdbot? whats the command?

strong sapphireBOT
fair eagle
#

run error: FailoverError: OAuth token refresh failed for anthropic: Failed to
refresh OAuth token for anthropic. Please try again or re-authenticate.
connected | error

strong sapphireBOT
fair eagle
#

what is the command in clawdbot to setup api key access with claude instead of claude max plan

strong sapphireBOT
fair eagle
#

error: too many arguments for 'configure'. Expected 0 arguments but got 1.

#

clawdbot models auth setup-token --provider anthropic

isn't it like this but api key instead?

strong sapphireBOT
fair eagle
#

okay i switched to API key and chose sonnet 4.5 as the mode. but when I run clawdbot tui its still showing anthropic/claude-opus-4-5 and no-output when I message. how do I change it to sonnet 4.5

strong sapphireBOT
fair eagle
#

how do I set it to use my api key now instead of claude max account?

strong sapphireBOT
fair eagle
#

it just says (no output) when trying to chat in clawdbot tui

#

I switched to API key

#

why would it still not work

#

i had rate limit usage on my plan so switched to api

strong sapphireBOT
fair eagle
#

already did

#

still same erro

strong sapphireBOT
# fair eagle still same erro

Let me check what's actually in your Anthropic config. Run:

clawdbot configure --show anthropic

This will display the current configuration. If OAuth tokens are still there, you'll need to manually remove them or re-run configure and make sure you select API Key as the auth method.

strong sapphireBOT
# fair eagle already did

Run these commands to force a clean restart:

clawdbot gateway stop
clawdbot gateway start

Then test again. If it still fails, run clawdbot configure again and paste the output so we can see exactly what's being saved.

fair eagle
#

error: unknown option '--show

strong sapphireBOT
# fair eagle error: unknown option '--show

The --show option doesn't exist. Check your config directly:

cat ~/.config/clawdbot/clawdbot5.json | jq '.anthropic'

Or use:

clawdbot config.get anthropic

This will show if the OAuth tokens are still present or if your API key was saved correctly.

fair eagle
#

max@Maxs-Mac-mini ~ % clawdbot configure --show anthropic
error: unknown option '--show'
max@Maxs-Mac-mini ~ % cat ~/.config/clawdbot/clawdbot5.json | jq '.anthropic'
cat: /Users/max/.config/clawdbot/clawdbot5.json: No such file or directory
max@Maxs-Mac-mini ~ % clawdbot config.get anthropic
error: unknown command 'config.get'
(Did you mean configure?)
max@Maxs-Mac-mini ~ %

strong sapphireBOT
fair eagle
#

for some reason claude won't change the mode. I tried changing to open ai model. then ran clawdbot models command and it still says opus. I've tried a restart and everything

strong sapphireBOT
fair eagle
strong sapphireBOT
# fair eagle still says opus...

Those are old sessions (1m ago to 39h ago) that started before you changed the model. New sessions will use the updated model.

Check the current default:

clawdbot model

Then test by starting a fresh session. The old sessions retain their original model. The one showing claude-3-5-haiku-20241022 proves the model change did work β€” it's just old cron sessions that haven't cycled yet.

fair eagle
#

is it possible its trying to use my oauth claude max plan instead of API key? how do I removed oauth completley for now

strong sapphireBOT
# fair eagle is it possible its trying to use my oauth claude max plan instead of API key? ho...

Yes, that's likely the issue. Let's clean out the OAuth tokens completely.

First, see what's in your Anthropic config:

cat ~/Library/Application\ Support/clawdbot/clawdbot5.json | jq '.anthropic'

Look for accessToken, refreshToken, expiresAt β€” those are OAuth leftovers. Remove them by editing the config or re-running configure and explicitly selecting API Key as auth method.

If you see OAuth tokens, run:

clawdbot configure

When asked about authentication, choose API Key and paste your key. This should overwrite the OAuth tokens.