Skip to content

Claude Code api_retry events remain unclassifiable when the SDK reports unknown/null status; turns can stall through blind retry storms #2225

Open

Description

@dhiyaancnirmal

Version

bb 0.39.0 (macOS host), Claude Code provider plugin

Summary

When the Claude Code CLI hits transient upstream API failures, it emits
api_retry stream messages that frequently carry no usable error identity:
error: "unknown" and error_status: null. bb relays each retry as a
provider/error event, but in exactly that case the event can only be
classified as category: "unknown" with httpStatusCode: null, which makes
the failure undiagnosable after the fact. Because the retry loop (up to
max_retries = 10 with exponential backoff) lives in the Claude Code CLI, bb
has no turn-level abort on consecutive failures, so a dead upstream can stall a
turn for minutes.

Observed

During one real session:

  • 85 provider/error retry events across parent and child threads; every one
    read like Claude Code API retry N/10 after Xms: unknown with
    category: "unknown" and no HTTP status.
  • A single turn burned 9 retries over ~244 seconds before the user interrupted.

What 0.39.0 already does right

  • The retry detail includes HTTP <status> when the SDK supplies
    error_status.
  • Retry events carry structured errorInfo
    (category, providerCode, httpStatusCode) derived from the SDK message,
    with an http-status fallback classifier.

The gap is bounded by what the Claude Code CLI puts on the stream: when it
reports unknown/null — which was 100% of observed events — there is nothing
left for bb to classify.

Suggestions

  1. Surface more transport context on api_retry if the CLI has it (underlying
    fetch error class, host, attempt timestamps), or expose the HTTP status so
    hosts can classify.
  2. Host-side guardrail in bb: after N consecutive api_retry events within one
    turn (or a cumulative stall threshold), abort the turn or emit a distinct
    hard-failure event instead of continuing to relay willRetry: true.

Activity

  1. added
    providers
    provider-claude-code
    on Aug 23, 2026
  2. added theissue type on Aug 23, 2026
  3. SawyerHood commented on Aug 24, 2026

    @SawyerHood
    Collaborator

    ---Auto-Generated---

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2225.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): The Claude Code CLI's api_retry classifier (aen(e) in the binary) only inspects e.status, so connection-level failures are emitted as error "unknown"/error_status null and bb can only relay category "unknown"; bb additionally has no per-turn retry guardrail (only the runtime's idle tracking reads willRetry), drops classification on the terminal error, and — a separate bb bug not in the issue — its claudeAssistantMessageErrorSchema lacks the SDK's "overloaded" value so HTTP 529 retries are downgraded to thread-scoped provider/unhandled rows instead of provider/error.
    • Proposed fix: (1) Add "overloaded" to claudeAssistantMessageErrorSchema in plugins/provider-claude-code/src/schemas.ts and map it to category "overloaded" in getProviderErrorCategoryFromClaudeCode (error-info.ts); verified: repro test goes 1-failed to 4-passed, existing delta-translation suite 57/57, typecheck clean, and a live 529 thread on the fixed build emits classified provider/error retries instead of "Unhandled Claude Code event". Derive the zod enum from the SDK's SDKAssistantMessageError union with a satisfies check and refresh the stale 529 fixture so future SDK drift fails typecheck. (2) In trans…
    • Caveats: The issue's "85 retry events in one session" count is unverifiable and was not needed. Reproduction used a local stand-in upstream (fake-upstream.mjs / closed port) via ANTHROPIC_BASE_URL rather than a real api.anthropic.com outage; the CLI code path is identical. The recorded-conformance suite had a pre-existing unrelated failure (recorded/fork) on the base commit in attempt 1 and was not re-run.…

    The report is self-contained: copy-paste repro steps with the test or script inline, expected vs actual output, screenshots where the bug is visual, and code permalinks at the base commit. It was independently re-executed by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Code

  4. added
    confirmed-repro
    on Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reproprovider-claude-codeproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions