Module: Rubino::LLM::FailoverReason

Defined in:
lib/rubino/llm/error_classifier.rb

Overview

Why an API call failed — determines recovery strategy. A faithful subset of the reference FailoverReason: only the CORE reasons this gem can actually act on are ported. Provider-niche reasons (thinking_signature, llama_cpp_grammar, encrypted_content, long_context_tier, image_too_large, …) are intentionally dropped.

The load-bearing default is ‘unknown → retryable`: an unclassifiable provider blip backs off and retries rather than aborting.

Constant Summary collapse

AUTH =

401/403 — invalid credential, don’t retry as-is

:auth
BILLING =

402 / credit exhaustion — don’t retry

:billing
RATE_LIMIT =

429 — backoff then retry

:rate_limit
OVERLOADED =

503/529 — provider overloaded, backoff

:overloaded
SERVER_ERROR =

500/502 — internal server error, retry

:server_error
TIMEOUT =

connection/read timeout / transport drop — retry

:timeout
CONTEXT_OVERFLOW =

context too large — compress, not failover

:context_overflow
MODEL_NOT_FOUND =

404 / invalid model — fallback to another model

:model_not_found
FORMAT_ERROR =

400 bad request — abort + fallback

:format_error
UNKNOWN =

unclassifiable — retry with backoff

:unknown
ALL =
[
  AUTH, BILLING, RATE_LIMIT, OVERLOADED, SERVER_ERROR, TIMEOUT,
  CONTEXT_OVERFLOW, MODEL_NOT_FOUND, FORMAT_ERROR, UNKNOWN
].freeze