Error glossary
This page lists the HTTP status codes returned by the Mistral API, their meanings, and how to resolve them.
Client errors (4xx)
Client errors (4xx)
Server errors (5xx)
Server errors (5xx)
Error response format
Error response format
All errors return a JSON body with this structure:
{
"object": "error",
"message": "A human-readable description of the error.",
"type": "invalid_request_error",
"param": "model",
"code": "unknown_model"
}| Field | Description |
|---|---|
message | Human-readable error description |
type | Error category (invalid_request_error, authentication_error, rate_limit_error, server_error) |
param | The parameter that caused the error (if applicable) |
code | Machine-readable error code (if applicable) |
Recommended retry strategy
Recommended retry strategy
For transient errors (429, 500, 502, 503, 504), implement exponential backoff:
import time
import random
from mistralai import Mistral
client = Mistral(api_key="YOUR_API_KEY")
def call_with_retry(func, max_retries=5):
for attempt in range(max_retries):
try:
return func()
except Exception as e:
if attempt == max_retries - 1:
raise
wait = (2 ** attempt) + random.uniform(0, 1)
time.sleep(wait)tip
The official Python and TypeScript SDKs include built-in retry logic with exponential backoff. Use the SDKs to avoid implementing this yourself.