- Resources
Error glossary
Error glossary
Here are the HTTP status codes and error codes returned by the Mistral API, their meanings, and how to resolve them. Most error responses include a four-digit code and a type that name the exact cause. Common error codes lists the codes reported most often.
Client errors (4xx)
400: Bad request
A 400 error means the request is malformed, or it contains a value that the model or endpoint doesn't accept. The message field describes the problem.
Common causes:
- Invalid JSON syntax
- A missing model field (code 1500, Missing model parameter.)
- An unknown or misspelled model name (code 1500, Invalid model: <name>)
- An argument value the model doesn't support, such as too many images or an unsupported reasoning_effort value (code 3051)
- temperature set to 0 while top_p is below 1 (code 3054, top_p must be 1 when using greedy sampling.)
- A prompt longer than the model's context window (code 3059)
Resolution: Read the message and code fields, then check your request body against the API reference. Validate JSON before sending.
- 1500: check the model field. To list the models you can use, call GET /v1/models on the same endpoint.
- 3054: send top_p: 1 with temperature: 0. Do this even if your request doesn't set top_p, because some models default to a value below 1.
401: Unauthorized
A 401 error means the API key is missing, invalid, or expired. For a missing or invalid key, the response body is {"detail": "Invalid API Key"}, with no code field.
Common causes:
- No Authorization header
- Incorrect or revoked API key
- An expired API key (see API key expiration policy)
Resolution: Verify your API key in Studio › API keys. Admins can review every key in the Organization in Admin Panel › API › API Keys. Ensure the header format is Authorization: Bearer YOUR_API_KEY. Billing problems return 402, not 401.
402: Payment required
A 402 error means a billing condition on your Organization blocks the request. The message and code fields say which one.
Common causes:
- The prepaid credit balance has reached zero (code 2308, Out of credits. Top up your balance to restore access.)
- Included monthly usage is exhausted and pay-as-you-go isn't enabled (code 2303, API budget exhausted.)
- The Vibe Code budget included in your plan is exhausted (code 2304, Vibe budget exhausted.)
- A recent invoice payment failed (code 2302, Please resolve your last payment failure to restore access.)
- A monthly spending limit is reached (code 2300 for the Organization, 2301 for a Workspace)
Resolution: Read the message: it says which condition applies. Then:
- To add credits or update your payment method, open Admin Panel › Subscriptions › Billing. For details, see Credits.
- For a failed payment, update the payment method, then pay the failed invoice. If you can't find a failed invoice, or the error continues after you pay, contact support.
- To use the API beyond your included monthly usage, enable pay-as-you-go with a positive credit balance.
- For code 2304, wait for your included usage to reset.
- For a spending limit, wait until it resets, or ask an admin to raise it. See Usage and limits.
- If the console shows a positive balance, or pay-as-you-go shows as enabled, and the error continues, contact support.
403: Forbidden
A 403 error means your account does not have permission to access the requested resource.
Common causes:
- Accessing a model not available on your subscription tier
- Attempting to delete a base model
- Workspace-level permissions restricting access
Resolution: Check your subscription tier and model access. Contact your workspace admin if you believe this is an error.
404: Not found
A 404 error means the requested resource does not exist.
Common causes:
- Invalid endpoint path or resource ID
- Referencing a deleted file, job, or conversation
- Typo in the URL
Resolution: Verify the resource ID and endpoint path. Use the list endpoints to confirm the resource exists. An unknown model name in the request body returns 400 with code 1500, not 404. If a 404 message names a model you didn't request, contact support.
422: Validation error
A 422 error means the request is well-formed JSON, but a field is missing or has a value the endpoint doesn't accept.
Common causes:
- A missing required field, such as messages (Field required)
- Wrong data type for a field, for example a string instead of a number
- Enum value not in the allowed set
- A field the endpoint doesn't accept, such as store sent by some OpenAI clients (Extra inputs are not permitted)
- Array length exceeding limits
Resolution:
- Read the detail list in the response body. In each item, loc names the field and msg says what's wrong.
- Add, fix, or remove that field, and check it against the API reference.
429: Too many requests
A 429 error means you exceeded a rate limit, or the model is out of capacity. The code field says which.
Common causes:
- Your Organization sent more requests or tokens than the model's rate limit allows (code 1300, Rate limit exceeded)
- Your Organization is on Free mode, where the main chat models have a limit of 0 (code 1300, and the x-ratelimit-limit-req-minute response header is 0)
- The model is out of capacity, which isn't your rate limit (code 3505 or 3801, Not enough capacity available for this request, please retry later.)
- Concurrent request limit reached
Resolution:
- Check the Retry-After response header, and the x-ratelimit-limit-* and x-ratelimit-remaining-* headers to see which limit you hit. Limits can apply per second, per minute, or per month. Find your limits in Admin Panel › API › Limits.
- For per-second and per-minute limits and for capacity errors, retry with exponential backoff. A monthly limit or a limit of 0 doesn't clear by retrying.
- On Free mode, enable pay-as-you-go.
- For sustained high throughput, use batch processing. For higher limits, see Request higher limits.
Server errors (5xx)
500: Internal server error
A 500 error means an unexpected error occurred on the server side.
Resolution: Retry the request after a brief delay. If the error persists, check status.mistral.ai or contact support.
502: Bad gateway
A 502 error means the server received an invalid response from an upstream service.
Resolution: Wait 30 to 60 seconds and retry. This is typically transient.
503: Service unavailable
A 503 error means the service is temporarily overloaded or under maintenance, or the model is out of capacity. Capacity errors carry code 3505 or 3801.
Resolution: Retry with exponential backoff. Check status.mistral.ai for ongoing incidents. If the model is out of capacity, you can also switch to another model for a while.
504: Gateway timeout
A 504 error means the request took too long to process.
Common causes:
- Very long prompts or high max_tokens values
- Server under heavy load
Resolution: Reduce input size or max_tokens. If using streaming, ensure your client handles the connection properly. Retry after a brief delay.
Error response format
Most errors return a JSON body with this structure:
{
"object": "error",
"message": "Rate limit exceeded",
"type": "rate_limited",
"param": null,
"code": "1300",
"raw_status_code": 429
}
Field | Description |
|---|---|
| message | Human-readable error description |
| type | The error's name, such as rate_limited, invalid_model, or billing_wallet_depleted |
| param | The parameter that caused the error (if applicable) |
| code | A four-digit error code, sent as a string. See Common error codes. |
| raw_status_code | The HTTP status code |
Some responses use a different shape:
- 401 errors return {"detail": "Invalid API Key"}. See 401: Unauthorized.
- 422 validation errors return {"detail": [...]}, with one item per invalid field. See 422: Validation error.
- Agents and Conversations errors have "object": "Error", "type": "invalid_request_error", and a numeric code.
- The OpenAI-compatible endpoint wraps the error in an error object, as OpenAI clients expect.
Common error codes
The code field names the exact cause of an error. This table lists the codes reported most often. It isn't a complete list: if you get a code that isn't listed and the message doesn't explain it, contact support with the full error body.
Code | Status | type | Message | What to do |
|---|---|---|---|---|
| 1000 | 500 or 503 | internal_server_error | Service unavailable. | Retry with backoff. Check status.mistral.ai. |
| 1100 | 503 | unreachable_backend | Internal server error | Retry with backoff. Check status.mistral.ai. |
| 1300 | 429 | rate_limited | Rate limit exceeded | Retry with backoff. If the x-ratelimit-limit-req-minute header is 0, enable pay-as-you-go. See 429. |
| 1500 | 400 | invalid_model | Invalid model: <name> or Missing model parameter. | Check the model field. List available models with GET /v1/models. |
| 2300 | 402 | billing_customer_monthly_spending_limit_reached | Customer monthly spending limit reached. Increase your limit to restore access. | Ask an admin to raise the Organization limit, or wait for next month. |
| 2301 | 402 | billing_workspace_monthly_spending_limit_reached | Workspace monthly spending limit reached. Increase your workspace limit to restore access. | Ask an admin to raise the Workspace limit, or wait for next month. |
| 2302 | 402 | billing_payment_failure | Please resolve your last payment failure to restore access. | Update the payment method, then pay the failed invoice. |
| 2303 | 402 | billing_api_budget_exhausted | API budget exhausted. | Enable pay-as-you-go with a positive credit balance. |
| 2304 | 402 | billing_vibe_budget_exhausted | Vibe budget exhausted. | Wait for your included usage to reset. |
| 2308 | 402 | billing_wallet_depleted | Out of credits. Top up your balance to restore access. | Add credits, or turn on auto recharge. |
| 3051 | 400 | invalid_request_invalid_args | Names the argument and the problem | Change the argument named in the message. |
| 3054 | 400 | invalid_request_greedy_sampling | top_p must be 1 when using greedy sampling. | Send top_p: 1 with temperature: 0. |
| 3059 | 400 | invalid_request_prompt_too_long | Prompt <N> > <M> maximum context length | Shorten the input or split it. |
| 3505 | 429 | backend_out_of_capacity | Not enough capacity available for this request, please retry later. | Retry with backoff, or use another model for a while. |
| 3505 | 503 | internal_server_error | Service unavailable. | Retry with backoff, or use another model for a while. |
| 3800 | 503 | internal_server_error | Service unavailable. | Retry with backoff. |
| 3801 | 429 | backend_out_of_capacity | Not enough capacity available for this request, please retry later. | Retry with backoff, or use another model for a while. |
| 3801 | 503 | internal_server_error | Service unavailable. | Retry with backoff, or use another model for a while. |
Recommended retry strategy
For transient errors (429, 500, 502, 503, 504), implement exponential backoff:
import time
import random
from mistralai.client 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)
The official Python and TypeScript SDKs include built-in retry logic with exponential backoff. Use the SDKs to avoid implementing this yourself.