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.

5 min readSume
All posts

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.

Sume error codes and what a client should do (read 2026-10-04)
StatusCodeClient action
400invalid_requestFix the request; do not retry
401unauthorizedFix the key
402insufficient_creditsStop; reduce cost or wait for balance
404model_not_found, not_foundCheck ids with the catalog
409idempotency_conflictSame key with a different body; use a new key for new work
429queue_fullWait for jobs to finish, then retry with the same key
429rate_limitedBack off; honor retry-after
503provider_capacity_exceededRetry 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

All Developers posts

Written by Sume