Map Sume API error codes to messages your app's users can act on
A translation table from Sume HTTP codes such as 402, 409, 413, 415 and 429 to user-facing copy, plus which errors the user cannot fix and should never see raw.

Show users a short instruction that matches what they can change, and keep the Sume code and request_id in your logs. Most Sume errors are not the user's fault: a 401, 503 or queue_full is your service's problem, and the user should only see "try again in a moment".
This table splits the documented codes by who can fix them. The codes come from the Sume errors page, read 2026-10-10.
The translation table
| Status and code | Who can fix it | Say to the user |
|---|---|---|
400 invalid_request | The user | Name the field that is wrong and keep their input |
401 unauthorized | You | Nothing specific; alert your team, show a generic failure |
402 insufficient_credits | Account owner | Ask the owner to add funds; others see "unavailable" |
404 not_found | You | The item is gone or not in this workspace; refresh the list |
409 job_not_cancelable | Nobody | It already finished; show the result |
413 payload_too_large | The user | Use a smaller file |
415 unsupported_media_type | You | A bug in your request headers; not shown |
429 rate_limited | Wait | Try again in a few seconds |
429 queue_full | Wait | Busy; your request was not accepted, try again soon |
503 provider_capacity_exceeded | Wait | Busy; retry later with the same key |
Keep two layers
Give the UI a small enum of your own, such as fix_input, ask_owner, retry_later and contact_support, and map Sume codes onto it in one place. The front end then never branches on a vendor string, and a new Sume code falls into contact_support by default instead of breaking a screen.
Failed jobs carry their own public error metadata (category, retryability, next action). Prefer the job's next_action field over guessing from the category, and use the job error categories post for the retry side.
- Never render the raw
messageto end users; it is written for developers. - Log
request_idwith every failure so support can find it. - Do not put API keys, signed URLs or raw media URLs in a user-visible error or a ticket.
Credits need a special case
A 402 is the one error where the right message depends on the viewer. The workspace owner can act on it; a team member cannot. Check the role before you show a "Top up" button, and for everyone else say the feature is temporarily unavailable. The balance route lets you check before submitting, so a warning banner can appear before any user hits the wall.
Test the mapping
Treat the mapping as code with tests. A simple table-driven test feeds each documented status and code pair through the function and asserts the enum it returns, plus one unknown code that must land on contact_support. Add a case where the body is not JSON at all, because a proxy or a client-blocking layer can answer with plain text, as the urllib 403 post shows.
Review the table when the Sume errors page changes, and keep the copy in one file so that a product writer can change the wording without touching the control flow.
- One test per documented code.
- One test for an unknown code.
- One test for a non-JSON body.
- One test that a
402shown to a non-owner never contains the word balance.
Sources
Related posts
More in Developers
- Move a Grok Imagine polling loop to Sume's /v1/videos in Python
Port an xAI Grok Imagine video poll loop to Sume: submit, idempotent retry, poll states, download and read usage.cost. A runnable Python script under 30 lines.
- Move a Vidu Q4 job to Sume: six fields to check before you submit
Vidu Q4 Preview's image-to-video fields (duration, resolution, start image, audio) mapped to Sume's /v1/videos names, with a Python filter for rows that fit.
- Music prompt rejected by policy: rewrite only the flagged part
If Sume Music rejects a prompt on policy, change the flagged content but keep the musical brief. The docs say not to flatten it to a generic bed; here is how.
- n=10 on the Sume Image API: docs say 10, catalog says 4 (Grok 1)
The Image API docs say n goes up to 10, but every catalog model caps lower: 4 for most, 1 for Grok Image, 1 or 4 for Soul. The 400 you get and how to batch.
Written by Sume