> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fortytwo.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

This guide provides a reference for all HTTP error codes with the following error response format:

```json theme={null}
{
  "error": {
    "message": "Human-readable error message",
    "type": "error_type_identifier",
  }
}
```

## Authentication Errors

If authentication fails, you will receive the following error response:

<AccordionGroup>
  <Accordion title="401 Unauthorized">
    This error occurs when your API key is missing, invalid, or expired.

    ```json theme={null}
    {
      "error": {
        "message": "Invalid authentication credentials",
        "type": "authentication_error",
      }
    }
    ```

    **Common causes:**

    * Missing `Authorization` header.
    * API key is not properly formatted (missing "Bearer" prefix).
    * Incorrect API key format.
    * Expired or revoked API key.

    **Troubleshooting:**

    * Verify that your API key is correct.
    * Make sure that the Authorization header is present: Authorization: Bearer YOUR\_FORTYTWO\_API\_KEY.
    * Contact support if the issue persists.
  </Accordion>
</AccordionGroup>

## Model Errors

<AccordionGroup>
  <Accordion title="404 Not Found (Model)">
    ```json theme={null}
    {
      "error": {  
        "message": "Model not found.",  
        "type": "model_not_found"  
      }  
    }
    ```

    **Common causes:**

    * The model ID is incorrectly defined.

    **Troubleshooting:**

    * Use the models endpoint [**`GET /v1/models`**](/apis/get-models) to find IDs of currently available models.
  </Accordion>
</AccordionGroup>

## Chat Completion Errors

### Validation Errors

Returned when the request body is invalid or contains validation errors.

<AccordionGroup>
  <Accordion title="400 Bad Request (Messages)">
    ```json theme={null}
    {
      "error": {  
        "message": "Missing required field: messages",  
        "type": "invalid_request_error"
      }  
    }
    ```

    **Common causes:**

    * Messages array is empty.
    * Invalid message role (must be: system, user, or assistant).
    * Required fields missing.
    * Type mismatches (e.g. string instead of number).

    **Troubleshooting:**

    * Refer to the '[Chat Completions](/docs/api-chat-completions)'.
  </Accordion>
</AccordionGroup>

### Rate Limiting Errors

Returned when rate limits or usage quotas are exceeded.

<AccordionGroup>
  <Accordion title="429 Too Many Requests (Concurrent)">
    ```json theme={null}
    {  
      "error": {  
        "message": "Too many concurrent requests. Retry after <X>s.",  
        "type": "rate_limit_exceeded"  
      }  
    }  
    ```

    **Common causes:**

    * More than X simultaneous active requests.
    * Queue is full: you already have X requests waiting in queue.

    **Troubleshooting:**

    * Wait for the timeout to expire.
    * Refer to your personal quotas and limits for preview access to keep within the limits.
  </Accordion>

  <Accordion title="429 Too Many Requests (Daily)">
    ```json theme={null}
    {
      "error": {  
        "message": "Daily quota exceeded. Resets at <Datetime>.",  
        "type": "rate_limit_exceeded"  
      }  
    }
    ```

    **Common causes:**

    * Exceeded daily request limit.

    **Troubleshooting:**

    * Wait for the quota reset at midnight UTC.
    * Refer to your personal quotas and limits for preview access to keep within the limits.
  </Accordion>

  <Accordion title="429 Too Many Requests (Monthly)">
    ```json theme={null}
    {
      "error": {  
        "message": "Monthly quota exceeded. Resets at <Datetime>.",  
        "type": "rate_limit_exceeded"  
      }  
    }
    ```

    **Common causes:**

    * Exceeded monthly request limit.

    **Troubleshooting:**

    * Wait for the quota reset at midnight UTC on the 1st of each month.
    * Refer to your personal quotas and limits for preview access to keep within the limits.
  </Accordion>
</AccordionGroup>

## Internal Server Errors

Returned when an unexpected error occurs on the server.

<AccordionGroup>
  <Accordion title="500 Internal Server Error">
    ```json theme={null}
    {  
      "error": {  
        "message": "Internal server error",  
        "type": "internal_error"  
      }  
    }  
    ```

    **Common causes:**

    * Connection failure.
    * Unexpected exception in the server logic.
    * Serialization/deserialization errors.

    **Troubleshooting:**

    * Try again later.
    * Contact support if the issue persists.
  </Accordion>
</AccordionGroup>
