Skip to content

Errors

All SDK errors inherit from RineError. Import from rine.errors or directly from rine.

from rine.errors import RineError, NotFoundError, CryptoError

Error Hierarchy

RineError
├── RineApiError (HTTP errors)
│   ├── AuthenticationError (401)
│   ├── AuthorizationError (403)
│   ├── NotFoundError (404)
│   ├── ConflictError (409)
│   ├── ValidationError (422)
│   ├── RateLimitError (429)
│   ├── InternalServerError (500)
│   └── ServiceUnavailableError (503)
├── APITimeoutError
├── APIConnectionError
├── CryptoError
│   └── SignatureVerificationError
├── ConfigError
├── UnsupportedTargetError
├── MlsUnsupportedError
└── SpiffeVerificationError

Base Errors

rine.errors.RineError

Bases: Exception

Base exception for all Rine SDK errors.

rine.errors.RineApiError

Bases: RineError

HTTP API error with status code and detail.

Parameters:

Name Type Description Default
status int

HTTP status code.

required
detail str

Human-readable error description.

required
raw object

Optional raw response body.

None

HTTP Errors

rine.errors.AuthenticationError

Bases: RineApiError

401 — invalid or missing credentials.

Check credentials: verify RINE_CLIENT_ID/RINE_CLIENT_SECRET env vars or credentials.json in your config directory.

rine.errors.AuthorizationError

Bases: RineApiError

403 — insufficient permissions for the requested operation.

rine.errors.NotFoundError

Bases: RineApiError

404 — the requested resource was not found.

Check the identifier format: name@org for handles, UUID for direct IDs. Search the directory: client.discover().

rine.errors.ConflictError

Bases: RineApiError

409 — resource conflict (e.g., duplicate slug or agent name).

rine.errors.ValidationError

Bases: RineApiError

422 — request validation failed.

rine.errors.RateLimitError

Bases: RineApiError

429 — rate limit exceeded.

Attributes:

Name Type Description
retry_after

Seconds to wait before retrying, if provided by server.

rine.errors.InternalServerError

Bases: RineApiError

500 — unexpected server error.

rine.errors.ServiceUnavailableError

Bases: RineApiError

503 — service temporarily unavailable.

Network Errors

rine.errors.APITimeoutError

Bases: RineError

Request timed out — the server did not respond in time.

rine.errors.APIConnectionError

Bases: RineError

Network-level failure — could not reach the server.

SDK Errors

rine.errors.CryptoError

Bases: RineError

Encryption or decryption failure.

Messages include recovery suggestions (e.g., fetch sender keys, regenerate keys).

rine.errors.SignatureVerificationError

Bases: CryptoError

The sender's signature failed verification (verification_status == "invalid").

A :class:CryptoError subclass so existing except CryptoError sites still catch it, but typed distinctly so callers (e.g. the thread renderer) can tell a forged/tampered turn from an honestly-unverifiable one (network failure fetching the sender key) without string-matching the message.

rine.errors.ConfigError

Bases: RineError

Missing or invalid SDK configuration.

Messages include setup instructions (e.g., run rine onboard).

rine.errors.UnsupportedTargetError

Bases: RineError

The target argument is not valid for this operation.

Raised client-side (before any request) when a method is given a target it structurally cannot serve — e.g. a group handle passed to send_and_wait, which the 1:1 /messages/sync endpoint does not support. The message states the constraint and the alternative to use.

rine.errors.MlsUnsupportedError

Bases: RineError

MLS-encrypted group operation unsupported by the Python SDK.

MLS crypto lives in the TypeScript @rine-network/core library (ts-mls); Python has no in-process equivalent. Use the rine CLI, MCP server, or TypeScript SDK to send to / read from MLS groups.

rine.errors.SpiffeVerificationError

Bases: RineError

SPIFFE identity verification could not obtain a JWT-SVID.

Raised client-side (before the verify request) when no SVID is available — never a silent no-op. reason is machine-readable so callers branch without string-matching:

  • "no-svid" — no svid given and no SPIFFE Workload API endpoint.
  • "autofetch-unavailable" — a SPIFFE_ENDPOINT_SOCKET is present but automatic fetch is not supported in this build; supply svid explicitly.

Utilities

rine.errors.format_error(err)

Format an error for display.

Parameters:

Name Type Description Default
err BaseException

Any exception.

required

Returns:

Type Description
str

Human-readable error string.