packages/cloud-frontend/content/errors.mdx
import { Callout, Cards } from "@/docs/components";
Learn how to handle API errors effectively in your elizaOS Cloud integrations.
All errors follow a consistent JSON format:
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable description",
"details": "Additional context (optional)",
"requestId": "req_abc123"
}
}
| Status | Meaning | Action |
|---|---|---|
400 | Bad Request | Fix request parameters |
401 | Unauthorized | Check authentication |
402 | Payment Required | Add credits or payment |
403 | Forbidden | Check permissions |
404 | Not Found | Verify resource exists |
409 | Conflict | Resolve conflict |
422 | Unprocessable | Fix validation errors |
429 | Rate Limited | Slow down, retry later |
500 | Server Error | Retry, contact support |
503 | Service Unavailable | Wait, retry later |
| Code | Description | Solution |
|---|---|---|
UNAUTHORIZED | Invalid/missing auth | Check API key |
INVALID_API_KEY | API key not recognized | Verify key is correct |
EXPIRED_TOKEN | Session expired | Re-authenticate |
FORBIDDEN | Insufficient permissions | Check key permissions |
| Code | Description | Solution |
|---|---|---|
INVALID_REQUEST | Malformed request | Check request format |
MISSING_FIELD | Required field missing | Add required field |
INVALID_FIELD | Field value invalid | Fix field value |
VALIDATION_ERROR | Schema validation failed | Check all fields |
| Code | Description | Solution |
|---|---|---|
NOT_FOUND | Resource doesn't exist | Verify resource ID |
ALREADY_EXISTS | Duplicate resource | Use existing resource |
CONFLICT | State conflict | Resolve conflict |
| Code | Description | Solution |
|---|---|---|
RATE_LIMITED | Too many requests | Wait and retry |
QUOTA_EXCEEDED | Plan quota exceeded | Upgrade plan |
| Code | Description | Solution |
|---|---|---|
INSUFFICIENT_CREDITS | Not enough credits | Top up account |
PAYMENT_REQUIRED | Payment needed | Add payment method |
PAYMENT_FAILED | Payment declined | Check payment method |
| Code | Description | Solution |
|---|---|---|
CONTENT_POLICY | Content policy violation | Modify content |
GENERATION_FAILED | Generation error | Retry with different input |
MODEL_UNAVAILABLE | Model offline | Try different model |
CONTEXT_LENGTH | Input too long | Reduce input size |
async function makeRequest(url, options) {
try {
const response = await fetch(url, options);
if (!response.ok) {
const error = await response.json();
switch (error.error.code) {
case "RATE_LIMITED":
const retryAfter = response.headers.get("Retry-After");
await sleep(retryAfter * 1000);
return makeRequest(url, options); // Retry
case "UNAUTHORIZED":
throw new AuthError("Invalid API key");
case "INSUFFICIENT_CREDITS":
throw new PaymentError("Please top up your account");
default:
throw new ApiError(error.error.message, error.error.code);
}
}
return response.json();
} catch (error) {
if (error instanceof ApiError) throw error;
throw new NetworkError("Network request failed");
}
}
import requests
import time
class ElizaAPIError(Exception):
def __init__(self, code, message):
self.code = code
self.message = message
def make_request(url, headers, data=None, retries=3):
for attempt in range(retries):
try:
response = requests.post(url, headers=headers, json=data)
if response.status_code == 429:
retry_after = int(response.headers.get('Retry-After', 60))
time.sleep(retry_after)
continue
if not response.ok:
error = response.json()['error']
raise ElizaAPIError(error['code'], error['message'])
return response.json()
except requests.RequestException as e:
if attempt == retries - 1:
raise
time.sleep(2 ** attempt) # Exponential backoff
These errors can be retried:
429 Rate Limited - Wait for Retry-After500 Server Error - Exponential backoff503 Service Unavailable - Wait and retryGENERATION_FAILED - Retry with modificationsDon't retry these:
400 Bad Request401 Unauthorized403 Forbidden404 Not FoundCONTENT_POLICYasync function retryWithBackoff(fn, maxRetries = 5) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (!isRetryable(error) || i === maxRetries - 1) {
throw error;
}
const delay = Math.min(1000 * Math.pow(2, i), 30000);
const jitter = Math.random() * 1000;
await sleep(delay + jitter);
}
}
}
Every response includes a request ID:
X-Request-Id: req_abc123def456
Include this when contacting support.
Enable verbose errors in development:
curl -X POST "https://elizacloud.ai/api/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Debug: true" \
-d '...'
Problem: Getting 401 errors on every request.
Solutions:
eliza_Authorization: Bearer YOUR_KEY or X-API-Key: YOUR_KEYProblem: Getting 429 errors during normal usage.
Solutions:
X-RateLimit-RemainingProblem: Getting 402 errors.
Solutions:
Problem: Stream responses come as a single chunk.
Solutions:
stream: true is set in your request bodyProblem: Agent ignores personality/style settings.
Solutions:
model parameter