Exceptions

Core

exception atproto_core.exceptions.AtProtocolError

Bases: Exception

Base exception.

exception atproto_core.exceptions.InvalidNsidError

Bases: AtProtocolError

exception atproto_core.exceptions.InvalidAtUriError

Bases: AtProtocolError

exception atproto_core.exceptions.InvalidCARFile

Bases: AtProtocolError

exception atproto_core.exceptions.DAGCBORDecodingError

Bases: AtProtocolError

Client

exception atproto_client.exceptions.ModelError

Bases: AtProtocolError

exception atproto_client.exceptions.ModelFieldNotFoundError

Bases: ModelError

exception atproto_client.exceptions.RequestErrorBase(response: Response | None = None)

Bases: AtProtocolError

Base of every error that comes out of an HTTP request.

Note

response is None when the failure happened before a response arrived, which is the case for every transport-level error (NetworkError and InvokeTimeoutError raised from an underlying HTTPX exception).

response: t.Optional[Response]

Response that carried the error, when one arrived.

exception atproto_client.exceptions.NetworkError(response: Response | None = None)

Bases: RequestErrorBase

Transport failure, or a status code that is worth retrying the same way (409, 413, 502).

Note

response is None when raised from a transport failure.

exception atproto_client.exceptions.InvokeTimeoutError(response: Response | None = None)

Bases: NetworkError

The request did not complete within the timeout of the underlying HTTP client.

Note

response is always None.

exception atproto_client.exceptions.UnauthorizedError(response: Response | None = None)

Bases: RequestErrorBase

exception atproto_client.exceptions.RequestException(response: Response | None = None)

Bases: RequestErrorBase

exception atproto_client.exceptions.BadRequestError(response: Response | None = None)

Bases: RequestErrorBase

exception atproto_client.exceptions.RateLimitExceededError(response: Response | None = None)

Bases: RequestException

The server answered with 429. The remaining budget is exposed as attributes.

Note

Inherits RequestException, which is what a 429 used to be raised as.

Example

>>> from atproto.exceptions import RateLimitExceededError
>>>
>>> try:
>>>     client.send_post(text='Hello')
>>> except RateLimitExceededError as e:
>>>     print('Retry at:', e.reset_at)
property limit: int | None

Number of requests the policy allows in the current window (ratelimit-limit).

property remaining: int | None

Number of requests left in the current window (ratelimit-remaining).

property reset_at: datetime | None

UTC time at which the current window resets (ratelimit-reset).

property policy: str | None

Policy the limit comes from, e.g. 100;w=300 (ratelimit-policy).

property retry_after: float | None

Seconds to wait before retrying (retry-after), or None when not usable.

Note:

The header carries either a number of seconds or an HTTP-date. Both are returned as seconds from now, never negative. Not every service sends it; prefer reset_at when it is absent.

exception atproto_client.exceptions.LoginRequiredError(message: str | None = 'To perform this action, you must be logged in. Use the `login` method first.')

Bases: AtProtocolError

Subscription

exception atproto_subscription.exceptions.SubscriptionError

Bases: AtProtocolError

Base exception of the subscription runtime.

exception atproto_subscription.exceptions.FrameDecodingError

Bases: SubscriptionError

Frame could not be decoded.

Firehose

Aliases of the subscription runtime’s exceptions, kept for backward compatibility.

atproto_firehose.exceptions.FirehoseDecodingError

alias of FrameDecodingError

atproto_firehose.exceptions.FirehoseError

alias of SubscriptionError

Jetstream

exception atproto_jetstream.exceptions.JetstreamError

Bases: AtProtocolError

exception atproto_jetstream.exceptions.JetstreamDecodingError

Bases: JetstreamError

exception atproto_jetstream.exceptions.JetstreamConsumerTooSlowError

Bases: JetstreamError

The server dropped the connection because the client fell too far behind.

exception atproto_jetstream.exceptions.JetstreamCursorTooOldError

Bases: JetstreamError

The requested cursor is below the server’s retention floor.

Identity

exception atproto_identity.exceptions.DidPlcResolverError

Bases: AtProtocolError

exception atproto_identity.exceptions.DidWebResolverError

Bases: AtProtocolError

exception atproto_identity.exceptions.PoorlyFormattedDidError

Bases: AtProtocolError

exception atproto_identity.exceptions.UnsupportedDidWebPathError

Bases: AtProtocolError

exception atproto_identity.exceptions.UnsupportedDidMethodError

Bases: AtProtocolError

exception atproto_identity.exceptions.PoorlyFormattedDidDocumentError

Bases: AtProtocolError

exception atproto_identity.exceptions.DidNotFoundError

Bases: AtProtocolError

exception atproto_identity.exceptions.AtprotoDataParseError

Bases: AtProtocolError

Crypto

exception atproto_crypto.exceptions.InvalidCompressedPubkeyError

Bases: AtProtocolError

exception atproto_crypto.exceptions.DidKeyError

Bases: AtProtocolError

exception atproto_crypto.exceptions.IncorrectMultikeyPrefixError

Bases: DidKeyError

exception atproto_crypto.exceptions.IncorrectDidKeyPrefixError

Bases: DidKeyError

exception atproto_crypto.exceptions.UnsupportedKeyTypeError

Bases: DidKeyError

exception atproto_crypto.exceptions.UnsupportedSignatureAlgorithmError

Bases: AtProtocolError

Server

exception atproto_server.exceptions.InvalidTokenError

Bases: AtProtocolError

exception atproto_server.exceptions.TokenDecodeError

Bases: InvalidTokenError

exception atproto_server.exceptions.TokenInvalidSignatureError

Bases: TokenDecodeError

exception atproto_server.exceptions.TokenInvalidAudienceError

Bases: InvalidTokenError

exception atproto_server.exceptions.TokenExpiredSignatureError

Bases: InvalidTokenError

exception atproto_server.exceptions.TokenInvalidIssuedAtError

Bases: InvalidTokenError

exception atproto_server.exceptions.TokenImmatureSignatureError

Bases: InvalidTokenError

Lexicon

exception atproto_lexicon.exceptions.LexiconParsingError

Bases: AtProtocolError