Skip to content

Failover wrapper errors missing provider and session_id in error logging #42713

Description

@theo674

Problem

When the gateway's failover system exhausts all auth profiles and model fallbacks, the resulting error log entries are missing provider and session_id metadata. This makes it difficult to attribute errors during post-mortem analysis.

Evidence

Analyzing the last 100 errors from our api_health_log table (structured ingestion from gateway.err.log):

  • 18 of 100 errors (18%) had no provider or session_id populated
  • These are all failover/wrapper errors — the final FailoverError after all profiles/models have been tried
  • The underlying per-profile errors DO have provider attribution, but the wrapper error that gets logged does not carry it through

Expected behavior

Failover wrapper errors should include:

  1. The provider(s) attempted (even if multiple)
  2. The session_id / lane that originated the request
  3. Consistent session_id format (currently we see both session:browser-XXXX and browser-XXXX for the same session)

Impact

When triaging rate limit storms or auth failures, the missing attribution means you have to manually correlate wrapper errors with nearby per-profile errors by timestamp. At scale (we had 6,000+ rate limit errors in 12 days), this makes automated analysis unreliable.

Environment

  • OpenClaw version: 2026.3.7
  • Providers: anthropic (token), openai-codex (OAuth)
  • Config: 3 anthropic profiles, 1 openai-codex profile, 2 model fallbacks

Suggestion

In the FailoverError constructor or the error logging path, propagate the provider from the last-attempted profile and the sessionId / lane from the originating request. For the session_id normalization, ensure the session: prefix is consistently applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions