Skip to content

fix(llm, openai): Classify overload errors as transient/retryable#624

Merged
JeanMertz merged 1 commit intomainfrom
prr192
May 8, 2026
Merged

fix(llm, openai): Classify overload errors as transient/retryable#624
JeanMertz merged 1 commit intomainfrom
prr192

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

The classify_stream_error function previously only treated server_error and api_error types as transient. This meant that overload-specific error signals were silently falling through to StreamError::Other, making them non-retryable.

Two additional cases are now covered:

  • service_unavailable_error type with code=server_is_overloaded is the documented in-stream form of OpenAI's 503 "engine is currently overloaded" condition. The discriminator lives in code, not type, so both fields are now checked.

  • overloaded_error type, used by some OpenAI-compatible providers that reuse Anthropic's error taxonomy.

Either a matching type or a matching code is sufficient to classify the error as transient, preserving any retry-after hint that may be present on the error.

The `classify_stream_error` function previously only treated
`server_error` and `api_error` types as transient. This meant that
overload-specific error signals were silently falling through to
`StreamError::Other`, making them non-retryable.

Two additional cases are now covered:

- `service_unavailable_error` type with `code=server_is_overloaded` is
  the documented in-stream form of OpenAI's 503 "engine is currently
  overloaded" condition. The discriminator lives in `code`, not `type`,
  so both fields are now checked.

- `overloaded_error` type, used by some OpenAI-compatible providers that
  reuse Anthropic's error taxonomy.

Either a matching `type` or a matching `code` is sufficient to classify
the error as transient, preserving any `retry-after` hint that may be
present on the error.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 9fd4ebf into main May 8, 2026
14 checks passed
@JeanMertz JeanMertz deleted the prr192 branch May 8, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant