All SDK errors derive from MinervaError. The hierarchy lets you catch
broadly (any SDK error) or narrowly (specific failure mode), and most carry
context attributes so you can build a useful UI without parsing message
strings.
The hierarchy
Quick reference
Insufficient credits (402)
When your Minerva credits are exhausted, the server returns HTTP 402 with code "insufficient_credits". This surfaces as MinervaAPIError with status_code=402. The response body’s details object includes records_remaining (an estimate of how many records you have left based on your credit balance) and records_requested (the batch size that was rejected):
Rate limits
retry_after is the server’s hint in seconds. Fall back to a sane default
(1s) if the server didn’t supply one.
Server errors
api_request_id is the server’s trace ID — quote it when reporting issues to
support. Responses are forward-compatible: fields the server adds later won’t
break an older SDK.
Validation errors
MinervaValidationError is raised locally before any HTTP call — bad
payload shape, over-the-limit record counts, missing required fields:
Use dry_run=True to trigger the same validation without committing to the
call — see Validation & dry_run.
Catch-all
MinervaAuthError is also raised when no MINERVA_API_KEY is set (or
api_key= passed) — that’s a local check, before any HTTP call. The error
message tells you exactly what’s missing.