# Errors & retries

Determine whether a request was accepted before correcting, waiting or retrying.

## Common cases

| Case | Recommended action |
| --- | --- |
| 401 | Check whether the key is correct, active and unexpired. |
| 403 / model_not_found | Check model access and membership instead of repeatedly submitting. |
| 429 | Back off as instructed by the server and reduce concurrency. |
| generation_pending | The task may still be running. Preserve the original idempotency key. |
| Expired quote | Get a fresh quote and use its quote_id. |
| Stream disconnected | Query the task or reconnect to its event stream. |

## Keep diagnostic details

Record the time, endpoint, HTTP status, error code and task ID. Remove API keys and private media before sharing diagnostics. Avoid logging only “generation failed”.
