Skip to main content

Module error

Module error 

Source
Expand description

The typed provider failure family and its retry classification (spec §24, §20.7).

Every adapter maps its vendor errors into a ProviderError: a ProviderErrorKind with its classification payload, the provider and model keys, and an optional short code. Nothing from the wire appears in one: Display and Debug render the kind, the keys and a code ErrorCode::new sanitized, never a body, a header, a prompt, user text or a secret (spec §25.2).

ProviderError::retry_class says what the caller may do next. Whether it may retry at all is FallbackStage’s to decide (I17).

RetryClassMeaning
RetryThe same provider may be tried again after a backoff.
RetryAfterThe same provider may be tried again, but only after the delay the provider asked for.
FallbackThis provider will keep failing; move to the next candidate that satisfies the same requirements.
FatalNeither retrying nor falling back can help; fail the stage.

Three kinds look alike from a status code and are not; the conformance suite has a row for each:

Looks likeActuallyWhy it matters
AuthenticationCredentialExpiredA wrong key stays wrong; an expired token works again after a refresh. Providers that issue short-lived credentials (Vertex AI bearer tokens, Bedrock session credentials) fail this way routinely.
RateLimitedQuotaExhaustedA rate limit clears by waiting; a quota or an empty balance does not, and several providers report both with HTTP 429.
InvalidRequestContextOverflowBoth arrive as HTTP 400; only one is fixed by shrinking the prompt.

Structs§

ErrorCode
A short, sanitized machine code an adapter attaches to a failure.
ProviderDetail
The endpoint’s own sentence about why it refused, sanitized.
ProviderError
A normalized provider failure.

Enums§

ProviderErrorKind
The failure families an adapter maps its vendor errors into.
RetryClass
What the caller may do after a failure (spec §20.7).

Constants§

MAX_ERROR_CODE_LEN
Maximum length of a sanitized ErrorCode, in bytes.
MAX_ERROR_DETAIL_LEN
Longest sanitized ProviderDetail, in bytes.