Error Response Format
All Anar products return errors in a consistent JSON format:
{
"error": "Human-readable error message"
}
Validation errors include additional detail:
{
"error": "Validation error",
"details": [
{
"loc": ["body", "text"],
"msg": "field required",
"type": "value_error.missing"
}
]
}
HTTP Status Codes
Success Codes
| Code | Name | Usage |
|---|---|---|
| 200 | OK | Standard success for GET, PUT, PATCH requests |
| 201 | Created | Resource successfully created (POST) |
| 204 | No Content | Resource successfully deleted (DELETE) |
Client Error Codes
| Code | Name | Error Message | Cause |
|---|---|---|---|
| 400 | Bad Request | "Invalid request body" | Malformed JSON, missing required fields |
| 401 | Unauthorized | "Invalid authentication token" | Missing, expired, or malformed JWT |
| 403 | Forbidden | "Role 'X' not authorized. Requires: Y, Z" | Valid JWT but insufficient permissions |
| 404 | Not Found | "Resource not found" | Requested ID does not exist |
| 409 | Conflict | "Resource already exists" | Duplicate name, ID collision |
| 413 | Payload Too Large | "Request body too large. Maximum: 10MB" | Request body exceeds size limit |
| 422 | Unprocessable Entity | "Validation error" | Request body fails schema validation |
| 429 | Too Many Requests | "Rate limit exceeded. Try again later." | Per-IP rate limit exceeded |
Server Error Codes
| Code | Name | Error Message | Cause |
|---|---|---|---|
| 500 | Internal Server Error | "Internal server error" | Unhandled exception in the backend |
| 502 | Bad Gateway | "Upstream provider error" | AI provider returned an error (via Gateway) |
| 503 | Service Unavailable | "Service starting up" | Backend is initializing or shutting down |
| 504 | Gateway Timeout | "Request timed out" | AI provider did not respond within timeout |
Product-Specific Errors
Gateway
| Error | Code | Description |
|---|---|---|
"Unknown model: <model>" | 400 | Requested model is not configured in any provider |
"All providers failed" | 502 | Every provider in the fallback chain returned an error |
"Provider rate limited" | 429 | Upstream AI provider rate limit hit |
"Invalid API key" | 401 | Gateway API key validation failed |
"RBAC: insufficient scope" | 403 | API key lacks required scope for the model |
Chat
| Error | Code | Description |
|---|---|---|
"Knowledge base not found" | 404 | Referenced knowledge base ID does not exist |
"Conversation not found" | 404 | Referenced conversation ID does not exist |
"Embedding generation failed" | 502 | Embedding provider returned an error during RAG ingest |
"Document too large for ingestion" | 413 | Uploaded document exceeds ingestion size limit |
Guard
| Error | Code | Description |
|---|---|---|
"Policy not found" | 404 | Referenced policy ID does not exist |
"Scan failed: model unavailable" | 502 | Llama Guard model returned an error |
"Invalid policy rule format" | 422 | Policy rule definition fails validation |
"Webhook delivery failed" | 502 | Alert webhook could not be delivered |
"Compliance framework not supported" | 400 | Requested framework is not available |
Voice
| Error | Code | Description |
|---|---|---|
"Unsupported audio format" | 400 | Audio file format is not supported (use WAV, MP3, M4A, FLAC) |
"Transcription failed" | 502 | Whisper model returned an error |
"Audio too long" | 413 | Audio file exceeds maximum duration |
"Language not supported" | 400 | Requested language code is not available |
Docs
| Error | Code | Description |
|---|---|---|
"Unsupported file type" | 400 | File type is not supported for processing |
"OCR failed: all providers exhausted" | 502 | Azure, EasyOCR, and Tesseract all failed |
"File too large" | 413 | File exceeds MAX_FILE_SIZE_MB |
"Document processing failed" | 500 | Internal error during document extraction |
Translate
| Error | Code | Description |
|---|---|---|
"Unsupported language pair" | 400 | Source/target language combination is not supported |
"Glossary not found" | 404 | Referenced glossary ID does not exist |
"TMX import failed" | 422 | TMX file format is invalid |
"Translation memory full" | 507 | Translation memory storage limit reached |
Flow
| Error | Code | Description |
|---|---|---|
"Workflow not found" | 404 | Referenced workflow ID does not exist |
"Maximum steps exceeded" | 400 | Workflow exceeds FLOW_MAX_WORKFLOW_STEPS |
"Step execution failed" | 500 | A workflow step threw an unhandled error |
"Circular dependency detected" | 422 | Workflow graph contains a cycle |
Comply
| Error | Code | Description |
|---|---|---|
"Framework not found" | 404 | Compliance framework definition not found |
"Assessment in progress" | 409 | An assessment is already running for this scope |
"Guard integration unavailable" | 502 | Guard service is unreachable |
Eval
| Error | Code | Description |
|---|---|---|
"Benchmark not found" | 404 | Referenced benchmark suite does not exist |
"Evaluation timed out" | 504 | Evaluation run exceeded time limit |
"Model not available" | 502 | Target model returned an error during evaluation |
Present
| Error | Code | Description |
|---|---|---|
"Template not found" | 404 | Referenced presentation template does not exist |
"Export failed" | 500 | PPTX or PDF generation failed |
"Slide limit exceeded" | 400 | Presentation exceeds maximum slide count |
Minutes
| Error | Code | Description |
|---|---|---|
"Meeting not found" | 404 | Referenced meeting ID does not exist |
"Audio upload failed" | 500 | Audio file storage failed |
"Transcription in progress" | 409 | Transcription is already running for this meeting |
Procure
| Error | Code | Description |
|---|---|---|
"Tender not found" | 404 | Referenced tender ID does not exist |
"Bid scoring failed" | 500 | Scoring engine returned an error |
"Invalid scoring criteria" | 422 | Scoring criteria definition is invalid |
Agents
| Error | Code | Description |
|---|---|---|
"Agent not found" | 404 | Referenced agent ID does not exist |
"Execution limit reached" | 429 | Agent exceeded maximum execution steps |
"Tool execution failed" | 500 | Agent tool call returned an error |
Insights
| Error | Code | Description |
|---|---|---|
"Dataset not found" | 404 | Referenced dataset does not exist |
"Query execution failed" | 500 | Analytics query failed |
"Row limit exceeded" | 400 | Query returned more rows than MAX_QUERY_ROWS |
Handling Errors in Client Code
Python
import httpx
async def safe_request(url: str, token: str):
async with httpx.AsyncClient() as client:
response = await client.get(
url,
headers={"Authorization": f"Bearer {token}"},
)
if response.status_code == 401:
# Token expired or invalid — re-authenticate
raise AuthenticationError("Token invalid")
if response.status_code == 429:
# Rate limited — back off and retry
retry_after = int(response.headers.get("Retry-After", 60))
await asyncio.sleep(retry_after)
return await safe_request(url, token)
response.raise_for_status()
return response.json()
TypeScript
async function apiRequest(url: string, token: string): Promise<any> {
const response = await fetch(url, {
headers: { Authorization: `Bearer ${token}` },
});
if (!response.ok) {
const body = await response.json();
if (response.status === 401) {
throw new Error("Authentication failed");
}
if (response.status === 429) {
throw new Error("Rate limited, retry later");
}
throw new Error(body.error || `HTTP ${response.status}`);
}
return response.json();
}