Skip to main content

enterprise_ai.errors

Source: sdks/python/src/enterprise_ai/errors.py. Back to the Python SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class EaiError​

Base error of the SDK. code is the stable machine code from the API.

Exception

Attributes:

NameTypeRequiredDescription
codeyesStable machine code of the error, for example policy_denied.
detailsyesStructured details of the error, secrets redacted (a dict, empty when none).
localeyesResolved language of the message, for example en.
messageyesHuman readable message in the chosen language.
messagesyesMessage per language as sent by the API (message_i18n), empty when absent.
request_idyesIdentifier of the failed request, or None.
statusyesHTTP status of the answer, or None when the error is local.

Constructor EaiError​

EaiError(message: str | None = None, code: str | None = None, status: int | None = None, details: dict[str, Any] | None = None, request_id: str | None = None, locale: str | None = None, messages: dict[str, str] | None = None) -> None

Create the error; without a message, it is looked up from code in the chosen locale, falling back to the code.

NameTypeDefaultRequiredDescription
messagestr | NoneNonenoHuman readable message; by default the translated text of code.
codestr | NoneNonenoStable machine code of the error, for example policy_denied; defaults to the default_code of the class.
statusint | NoneNonenoHTTP status of the answer, or None when the error is local.
detailsdict[str, Any] | NoneNonenoStructured details of the error; secrets are redacted before they are stored.
request_idstr | NoneNonenoIdentifier of the failed request, shown in str(error).
localestr | NoneNonenoLanguage of the message, for example fr; resolved from the environment when not given.
messagesdict[str, str] | NoneNonenoMessage per language from message_i18n, for example {"en": "...", "fr": "..."}.

Class AuthError​

Missing, invalid or insufficient credentials (HTTP 401, or 403 without a policy decision).

EaiError

Class PolicyDenied​

A policy decision refused the action. details usually carries reasons and decision_id.

EaiError

Class QuotaExceeded​

A quota or budget would be exceeded (HTTP 429 with code quota_exceeded or budget codes).

EaiError

Class EffortNotSupported​

The requested reasoning effort is not supported by the model and no compatible profile applies.

EaiError

Class ContextOverflow​

The assembled context does not fit in the model window after reservations.

EaiError

Class ApprovalRequired​

The action needs a human approval. details.approval_id identifies the pending request.

EaiError

Class NotFound​

The resource does not exist or is not visible to the caller tenant.

EaiError

Class ValidationError​

One invalid field of a request.

EaiError

Class ConflictError​

The resource state conflicts with the request (HTTP 409).

EaiError

Class RateLimited​

Too many requests (HTTP 429) after every retry was spent.

EaiError

Class ServerError​

The control plane failed (HTTP 5xx) after every retry was spent.

EaiError

Class TransportError​

The network failed before any HTTP answer was received.

EaiError

Class BudgetExhausted​

A local agent budget (steps, tool calls, tokens or cost) is spent.

EaiError

Class AgentStopped​

The kill switch stopped the agent (agent suspended, killed or run cancelled).

EaiError

Class EgressDenied​

An outbound call to a tenant provided URL was refused by the egress guard (HTTP 403).

EaiError

Attributes:

NameTypeRequiredDescription
reasonstr | NoneyesWhy the action is taken. Written to the audit trail with the actor and the time.

Class PromptInjectionBlocked​

The prompt or untrusted content was blocked by the prompt injection screen (HTTP 403, mode block).

EaiError

Class PayloadTooLarge​

The request body exceeds the server limit (HTTP 413).

EaiError

Class AuthzUnconfirmed​

An authorization answer carried no explicit decision of OPA or OpenFGA: the SDK never assumes an allow.

EaiError

Functions​

error_from_payload​

error_from_payload(status: int, payload: Any, locale: str | None = None, request_id: str | None = None) -> EaiError

Build the typed error for an HTTP status and a decoded body (envelope or not).

NameTypeDefaultRequiredDescription
statusintyesHTTP status of the answer; chooses the class when the error code is unknown (5xx gives ServerError).
payloadAnyyesDecoded error body, normally {"error": {code, message, message_i18n, details, request_id}}; any other value is accepted.
localestr | NoneNonenoLanguage of the message; picks the matching entry of message_i18n when present.
request_idstr | NoneNonenoRequest identifier used when the envelope carries none, usually the x-request-id header.

Returns: EaiError. A EaiError: Base error of the SDK. code is the stable machine code from the API.