Error Categories
1. Protocol Errors
Transport/connection issues not related to AdCP business logic:- Network timeouts
- Connection refused
- TLS/SSL errors
- JSON parsing errors
2. Task Errors
Business logic failures returned asstatus: "failed":
- Insufficient inventory
- Invalid targeting
- Budget validation failures
- Resource not found
3. Validation Errors
Malformed requests that fail schema validation:- Missing required fields
- Invalid field types
- Out-of-range values
Error Response Format
Failed operations return statusfailed with error details at the top level:
Error Response Fields
| Field | Description |
|---|---|
status | Always "failed" for errors |
message | Human-readable error description |
error_code | Machine-readable error code |
suggestions | Optional recovery suggestions |
field | Field path for validation errors |
retry_after | Seconds to wait before retry (rate limits) |
details | Additional context-specific information |
Standard Error Codes
Authentication Errors
| Code | Description | Resolution |
|---|---|---|
INVALID_CREDENTIALS | Invalid or malformed authentication credentials | Verify API key is correct and active |
TOKEN_EXPIRED | Authentication token has expired | Refresh OAuth token or re-authenticate |
INSUFFICIENT_PERMISSIONS | Account lacks required permissions | Contact administrator to upgrade permissions |
Validation Errors
| Code | Description | Resolution |
|---|---|---|
MISSING_REQUIRED_FIELD | Required parameter is missing | Include all required fields |
INVALID_FIELD_VALUE | Field value doesn’t meet requirements | Provide valid values per specification |
INVALID_FIELD_FORMAT | Field format is incorrect | Use correct format as specified |
Resource Errors
| Code | Description | Resolution |
|---|---|---|
RESOURCE_NOT_FOUND | Requested resource doesn’t exist | Verify ID is correct and current |
PRODUCT_NOT_FOUND | Product ID doesn’t exist | Use get_products to find valid IDs |
CREATIVE_NOT_FOUND | Creative ID doesn’t exist | Use list_creatives to find valid IDs |
Operation Errors
| Code | Description | Resolution |
|---|---|---|
INSUFFICIENT_INVENTORY | Not enough inventory for request | Expand targeting or reduce impressions |
BUDGET_EXCEEDED | Request exceeds budget limits | Reduce budget or request limit increase |
INVALID_TARGETING | Targeting criteria is invalid | Adjust targeting parameters |
CREATIVE_REJECTED | Creative failed policy validation | Review and fix creative content |
Rate Limiting Errors
| Code | Description | Resolution |
|---|---|---|
RATE_LIMIT_EXCEEDED | Too many requests | Wait for retry_after seconds |
System Errors
| Code | Description | Resolution |
|---|---|---|
INTERNAL_SERVER_ERROR | Unexpected server error | Retry request, contact support if persistent |
SERVICE_UNAVAILABLE | External service temporarily down | Wait and retry |
TIMEOUT | Request exceeded processing time | Retry with smaller request or contact support |
Retry Logic
Exponential Backoff
Implement exponential backoff for retryable errors:Error Categorization
Group errors by whether they’re retryable:Rate Limit Handling
Error Handling Patterns
Basic Error Handler
User-Friendly Messages
Convert technical errors to user-friendly messages:Structured Error Logging
Log errors with context for debugging:Webhook Error Handling
Failed Webhook Delivery
When webhook delivery fails, fall back to polling:Webhook Handler Errors
Handle errors in your webhook endpoint gracefully:Recovery Strategies
Context Recovery
If context expires, start a new conversation:Partial Success Handling
Some operations may partially succeed:Best Practices
- Categorize errors - Different errors need different handling
- Implement retries - Use exponential backoff for transient errors
- Respect rate limits - Honor
retry_aftervalues - Log with context - Include relevant IDs for debugging
- User-friendly messages - Convert technical errors for users
- Fallback strategies - Always have a backup (e.g., polling for webhooks)
- Don’t retry permanent errors - Validation errors need code fixes
- Handle partial success - Process warnings in successful responses
Next Steps
- Task Lifecycle: See Task Lifecycle for status handling
- Webhooks: See Webhooks for webhook error handling
- Security: See Security for authentication errors