Errors¶
A shallow hierarchy with structured fields (provider, phase, retryable,
http_status, detail, hint) — detail is bounded and redacted, hint is the
actionable next step. The prose catalog with examples lives in
the error reference.
anyinfer.AnyInferError ¶
AnyInferError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
Bases: Exception
Base class for everything this library raises.
Attributes:
| Name | Type | Description |
|---|---|---|
detail |
Human-readable description, redacted and truncated to 512 characters. |
|
provider |
The provider id involved, when one is. |
|
phase |
Phase
|
Lifecycle stage that failed. |
retryable |
Whether retrying the identical request could plausibly succeed. |
|
retry_after_s |
Server-advised delay before retrying, when supplied. |
|
http_status |
Status code, for errors that came from an HTTP response. |
|
hint |
The actionable next step to show a user, when one exists. |
anyinfer.Phase
module-attribute
¶
Phase = Literal[
"configure",
"discover",
"generate",
"stream",
"validate",
"cleanup",
]
Which stage of the request lifecycle produced an error.
anyinfer.ConfigError ¶
ConfigError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "configure",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
Bases: _ConfigurePhaseError
Invalid configuration, target string, catalog entry, or missing optional extra.
anyinfer.CredentialError ¶
CredentialError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "configure",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
Bases: _ConfigurePhaseError
A credential reference could not be resolved.
anyinfer.AuthError ¶
AuthError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
anyinfer.ProviderError ¶
ProviderError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
Bases: AnyInferError
Base for anything a provider surfaced.
Adapters raise only these; they never retry internally. The router decides
what to do based on retryable and
retry_after_s.
anyinfer.ProviderUnavailableError ¶
ProviderUnavailableError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = True,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
Bases: _RetryableProviderError
The provider is down, unreachable, or failed its health probe.
anyinfer.RateLimitError ¶
RateLimitError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = True,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
Bases: _RetryableProviderError
The provider rate-limited the request.
anyinfer.ModelNotFoundError ¶
ModelNotFoundError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
anyinfer.ContextLengthError ¶
ContextLengthError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
anyinfer.TransportError ¶
TransportError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = True,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
Bases: _RetryableProviderError
Connect, timeout, or TLS failure — no usable response was received.
anyinfer.StreamProtocolError ¶
StreamProtocolError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "stream",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
anyinfer.SchemaViolationError ¶
SchemaViolationError(
detail: str,
*,
raw_text: str = "",
errors: tuple[str, ...] = (),
provider: str | None = None,
phase: Phase = "validate",
hint: str | None = None,
)
Bases: AnyInferError
The response did not satisfy the requested schema, and the repair budget is spent.
Attributes:
| Name | Type | Description |
|---|---|---|
raw_text |
The model's raw output, so callers can inspect or salvage it. |
|
errors |
Human-readable validation error messages. |
anyinfer.ToolLoopError ¶
ToolLoopError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)
anyinfer.AllTargetsFailedError ¶
AllTargetsFailedError(
detail: str = "all routing targets failed",
*,
attempts: tuple[AttemptRecord, ...] = (),
hint: str | None = None,
)
Bases: AnyInferError
Every target in the route failed.
Attributes:
| Name | Type | Description |
|---|---|---|
attempts |
The complete routing trail, in order, including skipped targets. |
anyinfer.LocalRuntimeError ¶
LocalRuntimeError(
detail: str,
*,
provider: str | None = None,
phase: Phase = "generate",
retryable: bool = False,
retry_after_s: float | None = None,
http_status: int | None = None,
hint: str | None = None,
)