Requests and media

Errors and retries

The error format, the codes, and which ones to retry.

Every error has the same shape: an HTTP status and one error object.

FieldMeaning
codeStable, machine-readable. Branch on this.
messageFor people. Do not parse it.
request_idAlso in the x-sume-request-id header. Quote it to support.
retryabletrue when the same request can succeed later.
retry_after_secondsHow long to wait first, when known (also the retry-after header).
next_actionfix_input, authenticate, retry, inspect_events and similar.
detailsExtra facts, such as the failing fields for invalid_request.

Codes

HTTPcodeMeaningRetry?
400bad_requestThe body is not valid JSON.No, fix the body
400invalid_requestA field is missing or wrong. details.errors[] names it.No, fix the field
400concurrency_limit_reachedYour workspace has as many jobs running and queued as it may.After a job finishes
401unauthorizedNo key, or the key is wrong or revoked.No
401session_not_acceptedA dashboard session was sent to the public API.No, send a key
402insufficient_fundsThe open.sume.com balance cannot cover the price. details has required_usd and available_usd.After a top-up
403open_key_route_not_allowedThe key called a route outside the model API (list).No
404not_foundNo such job or model in your workspace.No
409idempotency_conflictThe Idempotency-Key was used for a different request.No, use a new key
409job_not_completedYou read a result before the job finished.Yes, poll first
409job_not_cancelableGeneration has started; the job can no longer be canceled.No
413payload_too_largeThe request body is too big.No
429rate_limitedToo many requests for your key in this window.Yes, after retry-after
503database_busyA short overload.Yes, after retry-after
500internal_errorA fault on Sume's side.Yes, with backoff

Malformed JSON is always a 400, never a 500:

Retrying safely

  • Retry GET requests after a network error, a 429 or a 5xx, with exponential backoff and jitter. Honour retry-after.
  • Retry a generate request only with the same Idempotency-Key. See Idempotency.
  • Do not retry 401, 403, 404 or a 400 you have not fixed.
  • A job that ends failed is not an HTTP error. Its error says what went wrong, and its price is refunded.