Error Handling
All errors follow a consistent format with an error message and code.Error format
Error codes
| HTTP Status | Code | Error Class | Description | Resolution |
|---|---|---|---|---|
| 401 | UNAUTHORIZED | UnauthorizedError | Missing or invalid API key | Check your Authorization: Bearer header |
| 401 | UNAUTHORIZED | NoCredentialsError | No credentials found in API key | Ensure channels are connected in workspace settings |
| 403 | FORBIDDEN | ForbiddenError | Access denied | Check API key permissions |
| 403 | FORBIDDEN | ChannelNotConnectedError | Channel not connected for this API key | Connect the channel in workspace settings |
| 404 | NOT_FOUND | NotFoundError | Route not found | Check the endpoint URL |
| 429 | RATE_LIMITED | RateLimitError | Rate limit exceeded | Wait and retry with backoff (see Rate Limits) |
| 500 | INTERNAL_ERROR | InternalError | Internal server error | Retry; contact support if persistent |
MCP tool errors vs HTTP errors
There are two levels of errors:HTTP-level errors
Returned as standard HTTP responses (status code + JSON body). These happen before a tool executes — auth failures, rate limits, missing routes.Tool-level errors
Returned inside a successful HTTP 200 response withisError: true in the MCP result. These happen during tool execution — invalid parameters, upstream API failures, etc.
Source-specific errors
Each ad platform can return specific errors that are caught and wrapped:Meta
MetaApiProcessingError— Graph API returned an error (invalid params, permissions, etc.)- Rate limiting — Meta’s Business Use Case rate limiting triggers automatic retries (3x with backoff)
- RestLi errors — LinkedIn’s API uses a specific error format that is normalized
serviceErrorCode— LinkedIn-specific error codes are included in the error message
ChannelNotConnectedError— Google credentials not found in API key- Cross-source errors —
/drive/upload-to-metarequires both Google and Meta channels connected