Skip to content

[Bug] Anthropic setup-token auth returns 401 Invalid bearer token on 2026.2.21-2 (isolated profile repro) #23538

@bigeasyfreeman

Description

@bigeasyfreeman

Environment

  • OpenClaw: 2026.2.21-2 (35a57bc)
  • OS: macOS 26.3 (arm64)
  • Node: 25.5.0

Summary
Anthropic auth via setup-token is accepted and stored, but runtime agent calls fail with:
HTTP 401 authentication_error: Invalid bearer token

I can reproduce this in a clean isolated profile, so this does not appear to be session/model leakage.

Repro steps

  1. Create/use isolated profile:
    openclaw --profile anth-test status

  2. Configure Anthropic model/auth in that profile (token flow):
    openclaw --profile anth-test models auth setup-token

  3. Confirm model/auth state:
    openclaw --profile anth-test models status

  • Default model: anthropic/claude-sonnet-4-6
  • Auth store shows anthropic token profile(s)
  1. Run agent turn:
    openclaw --profile anth-test agent --agent main --message "Reply with exactly: anthropic test ok" --json

Observed

  • agentMeta.provider = anthropic
  • agentMeta.model = claude-sonnet-4-6
  • payload text:
    HTTP 401 authentication_error: Invalid bearer token (request_id: req_...)

Expected

  • Successful Anthropic model response for valid setup-token auth.

Additional notes

  • I also tested with a separate anth-test gateway port and explicit gateway env targeting; same 401 behavior once provider/model were Anthropic.
  • Tokens were rotated during testing.
  • models auth login is not usable in this environment because CLI reports:
    “No provider plugins found. Install one via openclaw --profile anth-test plugins install”.

Potentially relevant

  • setup-token flow writes auth profile(s), but runtime bearer appears rejected by Anthropic API.
  • Could be token type mismatch, token ingestion/normalization issue, or provider auth handling regression in 2026.2.21-2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions