Skip to main content
The OMP Python SDK raises typed exceptions so you can write consistent error-handling logic regardless of which provider is underneath. All exceptions inherit from OMPError, carry a standard code, type, provider, and request_id, and mirror the error envelope that the OMP HTTP API returns on failure.

Import


Error hierarchy

All exceptions extend OMPError(Exception). Each subclass maps to a specific error.code value in the OMP wire format. All instances expose the following attributes:
  • e.message — human-readable description
  • e.code — machine-readable error code string
  • e.type — error category (auth, not_found, invalid, rate_limited, provider_error)
  • e.provider — the provider that raised the error, or None
  • e.request_id — the provider-assigned request ID for tracing, or None

Common error handling pattern

Catching OMPError as the final handler gives you a safe fallback for any OMP-originated exception.

Handling auth errors


Handling unsupported capabilities

Not all providers support every OMP verb. You can either check capabilities upfront or catch UnsupportedCapabilityError at call time:

Error envelope structure

When an OMP-native HTTP server returns an error, it uses this JSON envelope. The SDK parses this envelope and raises the matching exception class automatically.
You can reconstruct any OMPError subclass from a raw error dict using OMPError.from_response_dict():

Provider consistency guarantee

OMP guarantees that the same logical condition raises the same exception class regardless of which provider is active. For example, requesting a non-existent memory ID always raises NotFoundError — whether you’re using the postgres adapter, the mem0 adapter, or a native passthrough provider. You never need to write provider-specific error handling.

Ingestion timeout

ProviderError with code="ingestion_timeout" is a special case raised by async-ingestion providers (mem0, supermemory) when a memory fails to become searchable within the polling timeout. This is distinct from a generic backend failure.