# Error Codes

MAXIR AI uses standard HTTP response codes to indicate the outcome of API requests. Generally, codes in the `2xx` range indicate success; codes in the `4xx` range indicate a client error (e.g., invalid parameters); codes in the `5xx` range indicate a server error (these are less common).

---

## API Errors

| Error Code | Error Message | Description |
| :- | :- | :- |
| `400` | Bad Request | Invalid parameters. |
| `401` | Unauthorized | Invalid API Key. |
| `402` | Request Failed | Parameters are valid, but the request could not be completed. |
| `403` | Forbidden | The API Key used lacks the required permissions for this operation. |
| `404` | Not Found | The requested resource does not exist. |
| `409` | Conflict | Request conflicts with another operation (e.g., using the same idempotent key). |
| `429` | Too Many Requests | Too many requests sent in a given amount of time, exceeding the limit. |
| `500`, `502`, `503`, `504` | Server Errors | An error occurred on the MAXIR AI side (less common). |

---

## Error Types

| Error Type | Description |
| :- | :- |
| `authentication_error` | Authentication error, API Key is invalid, expired, or revoked. This could be due to input errors, formatting issues, or potential security problems. |
| `invalid_request_error` | Request error, the request contains invalid parameters. |
| `internal_server_error` | Internal server error, indicating a server-side issue occurred while processing the request; could be a temporary problem, bug, or system failure. |
| `idempotency_error` | Idempotency error, occurs when the same idempotency key is used for different API interfaces or parameter sets. |
| `rate_limit_error` | Rate limit error, your team has exceeded the limit of 20 API requests per second. |
| `permission_error` | You do not have permission to perform this operation. (Operation: %s, Resource: %s.) |

---

## Client Error Codes

| Error Code | Error Message | HTTP Status Code | Description |
| :- | :- | :- | :- |
| `300001` | Invalid parameters *`error_details>`* | 400 | Missing required parameters or parameter configuration errors. Please check that all parameters are correctly set. |
| `300002` | No permissions *`<error_details>`* | 200 | You do not have the necessary permissions to perform this action. |
| `300003` | *`<resource_name>`* not found | 200 | The specified resource does not exist in the project. Please verify that the resource ID is correct. |
| `300004` | Invalid file extension | 200 | Unsupported file extension. Supported extensions include **.csv**, **.tsv**, **.md**, **.mdx**, **.json**, **.txt**, **.pdf**, **.pptx**, **.ppt**, **.doc**, **.docx**, **.xls**, and **.xlsx**. |
| `300005` | Empty file | 200 | The file is empty, please verify the uploaded file is correct. |
| `300006` | Insufficient storage space | 200 | Not enough available storage space to upload the file. Please upgrade your capacity plan first. |
| `300007` | Failed to upload the file | 200 | An error occurred while uploading the file. Please check if the file format is supported and try again. |
| `300008` | An error occurred while generating the presigned URL | 200 | An error occurred while generating the presigned URL. Please check that all parameters are set correctly and try again. |
| `300009` | The number of sessions has reached the upper limit | 200 | The maximum number of sessions has been reached. Please delete unnecessary sessions and try again. |
| `300011` | Fail to create datasource | 200 | Unable to create datasource due to an internal error. |
| `210020` | Something went wrong during job execution. Please try again. | 400 | Job execution failed, please try again later. |
| `210021` | Job quota exceeded | 400 | Insufficient job quota, please upgrade your job plan. |
| `210022` | Question too long | 400 | The question is too long, supports a maximum of 6000 characters. |
| `210023` | Selected files are not all ready | 400 | Some of the selected files have not yet completed synchronization. |
| `210024` | Text too long for TTS service, limit is 5k characters. | 400 | The input text exceeds the 5000-character limit, please shorten the text. |
| `210025` | Too many selected files in the query | 400 | Too many files selected in the query. |
| `210026` | Invalid analysis | 400 | Data analysis failed, please try again later or set `stream` to true and reinitiate the task. |

---

## Server Error Codes

| Error Code | Error Message | HTTP Status Code | Description |
| :- | :- | :- | :- |
| `9999` | Internal server error | `500` | The request could not be processed due to an unknown error. |
| `201` | Rate limit reached for requests | `429` | Requests exceeded the allocated limit. Currently, each team can send up to 20 API requests per second. |
| `1002` | Expired credentials | `403` | The provided credentials have expired and are no longer valid; you may need to update or refresh the credentials. |
| `1003` | Insufficient authentication | `403` | The authentication information provided is insufficient or incomplete; please ensure all necessary authentication information is included. |
| `1004` | Bad credentials | `403` | The credentials provided are incorrect or improperly formatted; please verify the credentials are correct. |