Mixedbread

Error Handling

Common Status Codes

Understanding the status codes returned by the API is the first step in handling responses correctly. Here are the most common codes you might encounter:

CodeMeaningDescription
200OKRequest successful. The response contains the requested data.
401UnauthorizedMissing or invalid authentication credentials, or insufficient user permissions.
402Payment RequiredValid request, but the account needs a balance top-up or a valid payment method.
403ForbiddenThe authenticated user lacks the necessary permissions for the requested resource.
404Not FoundThe requested resource doesn't exist or cannot be found at the given URL.
422Validation ErrorThere was an issue with the request parameters. Check your input and retry.
429Too Many RequestsThe rate limit has been exceeded. The response may include retry timing info.
500Internal Server ErrorAn unexpected error occurred on the server-side. Retry the request later.
503Service UnavailableThe service is temporarily unavailable, likely due to maintenance or overload. Retry later.
504Gateway TimeoutA server acting as a gateway or proxy did not receive a timely response from an upstream server. Possible network issues or overload. Retry later.

Working With The SDKs

Our SDKs provide a great way for developers to interact with the Mixedbread API. Lets take a look at how to handle errors properly using the SDKs to ensure a good developer experience. Catching specific error types provided by the SDKs allows for more granular control and response logic.

Best Practices

Implementing robust error handling is crucial for a reliable application. Consider these best practices:

  1. Catch Specific Errors First (SDKs): When using the SDKs, always try to catch the most specific error types (like AuthenticationError, RateLimitError, etc.) before falling back to the base Exception/Error.
  2. Always Check the Status Code: Before processing the response body, check the HTTP status code to determine if the request was successful.
  3. Implement Retries: For transient errors like RateLimitError (HTTP 429), InternalServerError (HTTP 500), ServiceUnavailable (HTTP 503), and GatewayTimeout (HTTP 504), implement retry logic. Our SDKs allow configuring max retries automatically for certain errors. Consider using exponential backoff strategies.
  4. Log Errors: Log detailed error information, including timestamps, the request parameters (be mindful of sensitive data), the full error message or stack trace, and response details. This is invaluable for debugging.

Debugging and Support

  • For 4xx errors (Client Errors like 401, 403, 422), carefully review your request parameters, headers, authentication details, and permissions. The error response body often contains specific details.
  • For 5xx errors (Server Errors like 500, 503, 504), these indicate a problem on the server-side. Check our status page for any known issues. If the problem persists, retry later.

If you encounter persistent errors or issues not covered here:

Last updated: June 11, 2025