Skip to content

Exceptions

All exceptions inherit from AIMEError for easy catch-all handling.

from aime_loc import LOC, AIMEError, RateLimitError

try:
    profile = loc.scan("model-id")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except AIMEError as e:
    print(f"AIME error: {e}")

AIMEError

Bases: Exception

Base exception for all AIME LOC errors.

AuthenticationError

Bases: AIMEError

Invalid or missing API key (HTTP 401).

PermissionDeniedError

Bases: AIMEError

Tier doesn't include this feature (HTTP 403).

RateLimitError

Bases: AIMEError

Too many requests (HTTP 429).

Attributes:

Name Type Description
retry_after

Seconds to wait before retrying, if provided by the server.

QuotaExceededError

Bases: AIMEError

Monthly scan quota exceeded (HTTP 402).

Upgrade your tier at https://aime-loc.com/pricing

ModelNotFoundError

Bases: AIMEError

HuggingFace model ID not found or not supported (HTTP 404).

ScanInProgressError

Bases: AIMEError

A scan for this model is already running (HTTP 409).

Use the returned scan_id to poll for results.

ScanFailedError

Bases: AIMEError

The scan job failed on the server (HTTP 500 or job failure).

Attributes:

Name Type Description
scan_id

The failed scan's ID.

reason

Server-provided failure reason.

APIError

Bases: AIMEError

Unexpected server-side error.

Attributes:

Name Type Description
status_code

HTTP status code from the server.

request_id

Server request ID for debugging.

ValidationError

Bases: AIMEError

Invalid input parameters (HTTP 422).

ScanTimeoutError

Bases: AIMEError

Request or scan timed out.