Map your Sora error handling onto Sume's error envelope
Sume errors share one envelope: code, message, request_id. Rebuild your handler around code, rate-limit headers and retry-after, not message text.

Rebuild your error handler around Sume's error.code and request_id, not around message text. The errors guide says every error body carries a structured envelope with a code, message and request id that is safe to share with support. Codes decide behavior: invalid_request means fix the input, insufficient_credits means stop, queue_full and rate_limited mean back off, and provider_capacity_exceeded means retry with the same idempotency key.
From status code to action
A handler that only checks HTTP status loses information, because 429 has two meanings and 409 has several. Switch on error.code.
| Status | Code | Client action |
|---|---|---|
| 400 | invalid_request | Fix the request; do not retry |
| 401 | unauthorized | Fix the key |
| 402 | insufficient_credits | Stop; reduce cost or wait for balance |
| 404 | model_not_found, not_found | Check ids with the catalog |
| 409 | idempotency_conflict | Same key with a different body; use a new key for new work |
| 429 | queue_full | Wait for jobs to finish, then retry with the same key |
| 429 | rate_limited | Back off; honor retry-after |
| 503 | provider_capacity_exceeded | Retry later with the same key |
Headers worth reading
Public responses can carry ratelimit-limit, ratelimit-remaining, ratelimit-reset and retry-after. Use retry-after when present, and slow your submit loop as ratelimit-remaining approaches zero rather than waiting for the 429. The guide is explicit that unsafe submit requests should not be retried without an Idempotency-Key.
Log the request id, nothing sensitive
Store error.request_id next to your own job record so a support request is one lookup. The guide says not to include API keys, signed URLs, raw media URLs or private workspace ids when reporting an issue, so scrub those from logs before you paste them.
Job errors are separate
A job can fail after a clean 202. Failed jobs expose public error metadata such as category, stage, retryability and a next action, and the admission guide lists the reservation behavior. Handle submit errors and job errors as two layers, and keep your Sora-era retry decorator only for the first.
Sources
Related posts
More in Developers
- Mastodon media focal point: x and y from -1 to 1, 16:9 crops
Mastodon preview images are never cropped by the server, so apps crop them using a focal point from -1.0 to 1.0. How to compute it from a pixel in a Sume image.
- MCP 2026-07-28 deprecations: SSE, sampling, roots, logging checklist
MCP 2026-07-28 deprecates Roots, Sampling and Logging and reclassifies HTTP+SSE as Deprecated, with 12 months of notice. A checklist for media servers.
- MCP deprecations, removal from July 2027: audit Sume client
An MCP 2026-07-28 release candidate deprecates Roots, Sampling, Logging, Dynamic Client Registration and HTTP+SSE, removal no earlier than July 28, 2027.
- MCP OAuth without DCR: client ID metadata documents and issuer checks
MCP 2026-07-28 deprecates dynamic client registration for Client ID Metadata Documents and requires clients to validate iss. What it means for Sume.
Written by Sume