Skip to content

Errors

Every exception the package raises is a subclass of MimirError, so a single handler can cover the entire surface. Subclasses name exactly what went wrong:

Input errors — raised when the request itself is malformed:

  • ContextError — the context is not a valid type or structure.
  • RiskLevelError — the requested risk level is not a valid probability.
  • InputLimitError — a request exceeds the model's limits; the message names the value and the limit.

Artifact errors — raised before anything is read, when verification fails:

  • IntegrityError — a file's SHA-256 does not match the manifest.
  • SignatureError — the manifest's Sigstore signature is invalid or does not match the expected identity.
  • GraphContractError — the ONNX graph uses operators outside the allowlist.
  • FormatVersionError — the release format is not supported by this package version.

Policy errors — raised when the loaded policy is inconsistent with the runtime or hardware:

  • PolicyError — the policy file is malformed.
  • PolicyMismatchError — a custom policy was made for a different model, runtime, or hardware.
  • UncertifiedRuntimeError — the current runtime does not match the policy's certified configuration.
  • EquivalenceError — the hardware is not listed in the certificate and a decision differed in the equivalence check.

Server errors — raised by MimirClient on network or server failures:

  • ServerConnectionError — could not connect.
  • ServerTimeoutError — the request timed out after retries.
  • ServerResponseError — the server responded with an error status; subclasses preserve the status and body: InvalidRequestError, AuthenticationError, NotFoundError, RateLimitError, ServerError.

Install errors:

  • MissingExtraError — the call requires an extra that is not installed; the message names it.

mimir.core.errors

Exceptions raised by mimir. All derive from MimirError.

MimirError

Bases: Exception

Base class for all mimir exceptions.

ContextError

Bases: MimirError, ValueError

The context contains an unsupported or non-finite value.

RiskLevelError

Bases: MimirError, ValueError

The requested risk level is not certified by the loaded policy.

InputLimitError

Bases: MimirError, ValueError

The input exceeds a limit the release was tested at.

MissingExtraError

Bases: MimirError, ImportError

A feature requires an optional extra that is not installed.

ArtifactError

Bases: MimirError

The model artifact cannot be fetched or loaded.

IntegrityError

Bases: ArtifactError

A file is missing, not in the manifest, or has the wrong SHA-256.

SignatureError

Bases: ArtifactError

The manifest signature is missing, invalid or from an untrusted identity.

GraphContractError

Bases: ArtifactError

The graph violates its contract: opset, operators, external data or signature.

FormatVersionError

Bases: ArtifactError

The artifact or policy format is not supported by this package version.

UncertifiedRuntimeError

Bases: MimirError

The ONNX Runtime version, provider or provider options are not certified.

EquivalenceError

Bases: MimirError

Decisions on the equivalence set differ from the certified ones.

PolicyError

Bases: MimirError

The policy file is malformed or inconsistent with its arrays.

PolicyMismatchError

Bases: PolicyError

The policy was certified for a different model, graph or runtime.

ClientError

Bases: MimirError

A request to a MIMIR server failed.

ServerConnectionError

Bases: ClientError

The server could not be reached or closed the connection.

ServerTimeoutError

Bases: ClientError

The server did not respond within the timeout.

ServerResponseError

Bases: ClientError

The server returned an error status. status and body are kept.

InvalidRequestError

Bases: ServerResponseError

HTTP 400 or 422: the request failed validation.

AuthenticationError

Bases: ServerResponseError

HTTP 401 or 403: the API key is missing, invalid or not permitted.

NotFoundError

Bases: ServerResponseError

HTTP 404: unknown route or tool.

RateLimitError

Bases: ServerResponseError

HTTP 429: rate limit exceeded.

ServerError

Bases: ServerResponseError

HTTP 5xx: server failure or overload.