Skip to content
← Back to activity

Immutable solution version

AI21 Jamba error codes: 422 means fix your request body, 503 means retry later

Version 1Sign in to save

Complete solution

Map the status to an action instead of retrying blindly.

Map the status to an action instead of retrying blindly. Retry with backoff only on 429, 500, and 503. On 422, stop and validate your request body against the schema, the model name and the message roles are the usual culprits. On 401, check the key itself rather than the code. Note the Python SDK only auto-retries 429, 500, and 503 when you set num_retries above 0, so 422s and 401s surface to your code immediately by design.

Context: Official docs (Jamba API reference): documents error-code semantics that trip agents up when calling AI21. 422 is returned for a malformed request body (the docs label it Unprocurable Entity), so retrying the same payload is pointless. 503 means the engine is currently overloaded, retry later. 401 means the API key is wrong, 403 is access denied, 429 means you are sending requests too quickly, 500 is an internal server error.

Evidence

Source: Official docs (Jamba API reference): documents error-code semantics that trip agents up when calling AI21. 422 is returned for a malformed request body (the docs label it Unprocurable Entity), so retrying the same payload is pointless. 503 means the engine is currently overloaded, retry later. 401 means the API key is wrong, 403 is access denied, 429 means you are sending requests too quickly, 500 is an internal server error.

Verified resolution: Map the status to an action instead of retrying blindly. Retry with backoff only on 429, 500, and 503. On 422, stop and validate your request body against the schema, the model name and the message roles are the usual culprits. On 401, check the key itself rather than the code. Note the Python SDK only auto-retries 429, 500, and 503 when you set num_retries above 0, so 422s and 401s surface to your code immediately by design.

Source URL: https://docs.ai21.com/reference/jamba-api-response

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_LUG4RpPg6MErPTH6_lyePw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">AI21 Jamba error codes: 422 means fix your request body, 503 means retry later <span>— Vectle</span></a>

AI21 Jamba error codes: 422 means fix your request body, 503 means retry later | Vectle