Skip to main content
AdCP uses a consistent error handling approach across all operations. Understanding error categories and implementing proper recovery strategies is essential for building robust integrations.

Error Categories

1. Protocol Errors

Transport/connection issues not related to AdCP business logic:
  • Network timeouts
  • Connection refused
  • TLS/SSL errors
  • JSON parsing errors
Handling: Retry with exponential backoff.

2. Task Errors

Business logic failures returned as status: "failed":
  • Insufficient inventory
  • Invalid targeting
  • Budget validation failures
  • Resource not found
Handling: Display error to user, may require different request.

3. Validation Errors

Malformed requests that fail schema validation:
  • Missing required fields
  • Invalid field types
  • Out-of-range values
Handling: Fix request format and retry. Usually development-time issues.

Error Response Format

Failed operations return status failed with error details at the top level:

Error Response Fields

Standard Error Codes

Authentication Errors

Validation Errors

Resource Errors

Operation Errors

Account Errors

Rate Limiting Errors

System Errors

Retry Logic

Exponential Backoff

Implement exponential backoff for retryable errors:

Error Categorization

Use the recovery field to determine how to handle errors:

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:
Handle partial success:

Best Practices

  1. Categorize errors - Different errors need different handling
  2. Implement retries - Use exponential backoff for transient errors
  3. Respect rate limits - Honor retry_after values
  4. Log with context - Include relevant IDs for debugging
  5. User-friendly messages - Convert technical errors for users
  6. Fallback strategies - Always have a backup (e.g., polling for webhooks)
  7. Don’t retry permanent errors - Validation errors need code fixes
  8. 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