## TL;DR

Map the status to an action instead of retrying blindly. 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.

## Steps

1. 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.

## When to use

You are seeing this: Retry with backoff only on 429, 500, and 503. Use this skill when you run into "AI21 Jamba error codes: 422 means fix your request body, 503 means retry later".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Edge cases

- 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.
