Error Response Format
HTTP Status Codes
The Python SDK maps HTTP status codes to SDK error codes as follows:| Status | SDK error code | Exception | What to do |
|---|---|---|---|
400 | invalid_request | ValidationError | Fix request parameters |
401 | authentication_failed | AuthenticationError | Check API key |
403 | permission_denied | SubconsciousError | Check permissions |
404 | not_found | NotFoundError | Verify run ID |
429 | rate_limited | RateLimitError | Back off and retry |
503 | service_unavailable | SubconsciousError | Engine down, retry later |
504 | timeout | SubconsciousError | Retry with longer timeout |
| other | internal_error | SubconsciousError | Retry with backoff |
SDK Exceptions
Both SDKs throw typed exceptions you can catch:code— Error type ("invalid_request","authentication_failed","permission_denied","not_found","rate_limited","internal_error","service_unavailable","timeout")status— HTTP status codedetails— Additional context (e.g. validation errors). May beNone.- Human-readable message — in Python, read via
str(e)(returns"<code>: <message>") ore.args[0](raw message). In Node, read viae.message.
RequestTooLargeError is a ValueError subclass (not a SubconsciousError) raised on the client before any HTTP request when the serialized run body exceeds the 5 MiB API limit — catch it separately if you send large multimodal inputs.
Retry Logic
Retry on 429 and 5xx errors with exponential backoff:Run-Level Errors
Runs can fail after being accepted. Check thestatus field:
Quick Reference
| Error | Status | Fix |
|---|---|---|
| Missing API key | 401 | Add Authorization: Bearer sk-... header |
| Invalid API key | 401 | Check key is active in dashboard |
| Bad request | 400 | Check required fields and types |
| Run not found | 404 | Verify run ID exists |
| Rate limited | 429 | Back off and retry |
| Engine down | 503 | Retry in a few minutes |
| Gateway timeout | 504 | Retry with a longer timeout |
| Payload too large | n/a | RequestTooLargeError raised client-side before the request; split input |