Skip to main content

Module errors

Module errors 

Source
Expand description

Error codes, their classes, and the two error shapes of classify.run.

An admission refusal answers the whole request with an ERROR frame whose body is {code, message, detail} (Refusal); it writes nothing and dispatches nothing. After admission the batch never fails as a whole: an item that could not be answered carries an ItemError in its place in the reply.

Codes are open strings on the wire: a code this crate does not list is kept as it was sent. Classes decode open too (ErrorClass::Other); a caller that meets an unknown class treats it as permanent (ErrorClass::effective), which is the safe direction.

Modules§

classes
Class names. The set is fixed for classifier/v1; a new class means a new role version.

Structs§

ItemError
An item’s error in a classify.run reply: {code, class, message, retry_after_ms?}.
Refusal
An admission refusal: the body of the ERROR frame classify.run answers with, {code, message, detail}, the shape of subc_protocol::ErrorBody with a typed detail.
RefusalDetail
The detail of an admission refusal. Which members are present depends on the code (see the contract’s table); class is always present, so a caller that meets an unknown code still knows whether to retry.

Enums§

ErrorClass
An error class. Decodes open: a value other than classes is kept in ErrorClass::Other. Non-exhaustive, so a match needs a wildcard arm and adding a variant later is not a breaking change.

Constants§

ACCOUNT_WALLED
The provider account is at its limit. detail.resets_at_ms when known. Transient.
ADMISSION_CODES
Every admission refusal code, in the contract’s table order.
AUTH_FAILED
The provider refused the module’s credentials (HTTP 401 or 403). Permanent. As an admission refusal: the call’s first provider call met it, so the whole call is refused and nothing is written. As a per-item error: it stopped the call, and every item the call left unanswered carries it. Never stored, so a re-send after a re-login asks the provider again.
BATCH_ID_REUSE
The batch_id names a recorded batch whose body differs. detail.field names the first differing field. Permanent.
BATCH_IN_PROGRESS
Another call holds this batch_id. detail.retry_after_ms says when to re-send. Transient. Nothing was written or dispatched.
COST_EXCEEDED
As an admission refusal: the batch’s estimated cost is over max_cost_usd; detail.estimate_usd and detail.max_cost_usd carry both. As a per-item error: answering the item would cross the batch’s ceiling. Permanent either way.
INVALID_ITEM
The provider rejected this item’s input (400, 413, 422, or another 4xx the contract does not map elsewhere). Permanent.
INVALID_PARAMS
A malformed request, or a limit exceeded. detail.field names the field, and detail.limit the limit where one applies. Permanent.
ITEM_CODES
Every per-item error code, in the contract’s table order. cost_exceeded, auth_failed and model_unavailable are both admission refusals and per-item errors.
MODEL_NOT_CLASSIFIER
The model’s catalog row is not a classifier. detail.model and detail.kind name it and its kind. Permanent.
MODEL_UNAVAILABLE
The provider does not serve the model (HTTP 404). Permanent. As an admission refusal, detail.model names the model; the call’s first provider call met it, so the whole call is refused and nothing is written. As a per-item error: it stopped the call, and every item the call left unanswered carries it. Never stored, so a re-send after a catalog fix asks the provider again.
MODEL_UNKNOWN
The model is not in the runner’s catalog. detail.model names it. Permanent.
PROVIDER_ERROR
The provider answered 5xx, or the transport failed, after the runner’s own retries. Transient.
PROVIDER_REFUSED
The provider refused the content. Permanent.
RATE_LIMITED
The provider answered 429 or 529 after the runner’s own retries. retry_after_ms when the provider gave one. Transient. It stops the call: the items after it that would need a provider call are not sent, and carry rate_limited too, unstored, so a re-send retries them.

Functions§

admission_class
The class of an admission refusal code this crate lists, None for any other code.
item_class
The class of a per-item error code this crate lists, None for any other code.