Error handling
This page shows you how to handle errors across the Jockey API: catch typed exceptions, retry transient failures, and poll for asynchronous status.
Error response format
When a request fails, the SDK raises a typed exception: ApiError in Python and TwelvelabsApiError in Node.js. The exception includes the HTTP status code and the parsed error body, which follows the same shape across the API:
Catch the exception and inspect its status code and body:
HTTP status codes
The status code is available on the exception (status_code in Python, statusCode in Node.js).
Retry strategy
Retry on transient errors (429 rate limits and 5xx server errors). Do not retry client errors (400, 401, 403, 404). Fix the request instead.
Common errors by endpoint
Assets
Knowledge stores
Knowledge store items
Responses
Polling and async status
The platform processes content asynchronously. Any time you create an asset or add videos and images to a knowledge store, processing happens in the background. Poll the resource until it reaches the ready status before proceeding.
Polling helper
Usage
Recommended intervals
Batch polling
Wait for multiple resources in parallel:
Polling pitfalls
- Don’t poll too aggressively: 1-second intervals waste rate limit budget
- Always handle
failed: failed resources don’t recover - Set a timeout: don’t poll forever if something goes wrong
- Rely on polling: webhooks are not available during the research preview