Errors
The Transcodely API uses Connect-RPC error codes with structured error details. Every error response includes a machine-readable code, a human-readable message, and — for validation errors — field-level details that pinpoint exactly what went wrong.
Error Response Format
All error responses follow this structure:
{
"code": "invalid_argument",
"message": "validation failed: outputs[0].video[0].codec: value is required; outputs[0].video[0].h264.crf: value must be greater than or equal to 0 and less than or equal to 51",
"details": [
{
"type": "transcodely.v1.ErrorDetails",
"value": "ChB2YWxpZGF0aW9uX2Vycm9yEqR2YWxpZGF0aW9uIGZh...",
"debug": {
"code": "validation_error",
"message": "validation failed: outputs[0].video[0].codec: value is required; outputs[0].video[0].h264.crf: value must be greater than or equal to 0 and less than or equal to 51",
"field_violations": [
{
"field": "outputs[0].video[0].codec",
"description": "[parameter_required] value is required"
},
{
"field": "outputs[0].video[0].h264.crf",
"description": "[parameter_out_of_range] value must be greater than or equal to 0 and less than or equal to 51"
}
]
}
}
]
}Key design decisions:
- All validation errors are returned at once — the API does not stop at the first error
- Field paths include array indices — e.g.,
outputs[0].video[0].h264.crf - Errors are machine-readable — the
codefield is always a stable, lowercase string - Every field violation carries its own code — each
descriptionreads[<code>] <message>, whichever validator refused the field
Connect-RPC Error Codes
| Code | HTTP Status | Description |
|---|---|---|
invalid_argument | 400 | Request validation failed (bad input) |
not_found | 404 | Resource does not exist |
already_exists | 409 | Resource already exists (e.g., duplicate slug) |
permission_denied | 403 | Authenticated but not authorized for this action |
unauthenticated | 401 | Missing or invalid API key |
failed_precondition | 400 | Request cannot be fulfilled in current state |
resource_exhausted | 429 | Rate limit exceeded |
internal | 500 | Unexpected server error |
unavailable | 503 | Service temporarily unavailable |
deadline_exceeded | 504 | Request timed out |
unimplemented | 501 | Endpoint not yet implemented |
Error code catalog
Alongside the Connect code, most errors carry a stable error_code slug — returned as an error-code header on the error metadata and, for the errors that also fail a job, as the job’s own error_code field. Switch on the slug, not on the message.
A field validation refusal is the one exception. Its error-code header is invalid_argument, and the specific code (parameter_required, parameter_out_of_range, parameter_forbidden and so on) sits on each field violation instead, because one request can break several fields for different reasons.
These are the codes your plan’s limits can produce:
| Connect code | error_code slug | Cause |
|---|---|---|
resource_exhausted | limit_exceeded | The app reached its monthly spend limit. Clears when the next billing period starts or the limit is raised. Also appears as a job error_code when the limit was reached while the job waited to start; the job fails before encoding, nothing is charged, and a job.failed webhook fires. See Spend Limits. |
resource_exhausted | queue_limit_exceeded | The app’s queue is at its ceiling. Clears as queued jobs drain — retry with backoff. |
invalid_argument | output_duration_limit_exceeded | The job’s effective encode duration exceeds the output duration cap of the plan or the free tier. On the free tier a hosted video is shortened to the cap instead, so this comes from a job or from a plan-capped or delinquent account. Also appears as a job error_code when the source duration is only learned at probe time; the job fails and a job.failed webhook fires. The cap applies to what would be encoded — a clip range within the cap is accepted regardless of source length. |
invalid_argument | quality_tier_not_allowed | An output (or ABR variant) requests a quality tier outside the plan’s allowed set. Always rejected at create time. Omitted tiers default to standard, which may itself be outside the set. |
The two resource_exhausted codes are worth retrying, because the condition behind them clears on its own. The two invalid_argument codes are not: the request as written is over a plan limit and will be over it again. Change the request, or talk to us about a plan change.
Hosting codes
Managed delivery — a job with managed: true, a video created from a URL, or an upload — provisions the app’s hosting infrastructure on first use. That is the one step in the path that depends on infrastructure outside the request.
| Connect code | error_code slug | Cause | Clears when |
|---|---|---|---|
unavailable | hosting_provisioning_failed | Storage or the CDN zone for the app could not be provisioned. Nothing was created — no job, no video — and nothing was billed. | Usually on its own within moments; retry the same request |
unavailable | delivery_regions_update_failed | An UpdateHostingConfig call changed delivery_regions, and the CDN could not confirm the new delivery regions. The change was not saved, and the previous regions were restored where possible. | Usually on its own within moments; retry the same request |
unavailable | hosting_config_busy | Another change to this app’s hosting settings was still being applied when an UpdateHostingConfig call arrived. Nothing was saved. | Once the other change finishes; retry the same request in a few seconds |
These are the refusals in this page worth a plain retry. None of them says anything about your request, which is why resending it unchanged is the right move: retry once after a short pause, and again with backoff if it repeats.
Billing and balance codes
These codes are about money rather than capacity. None of them clears on its own — no queue drains and no billing period resets them — so retrying on a backoff asks a question whose answer cannot change. Each one names a remedy instead.
| Connect code | error_code slug | Cause | Clears when |
|---|---|---|---|
failed_precondition | billing_past_due | A statement issued to your organization is unpaid and has reached day 7 of the payment-failure schedule. New jobs are refused; queued and running work is unaffected. | The statement is paid |
failed_precondition | outstanding_balance_exceeded | Usage that has not been invoiced yet reached twice your organization’s balance threshold. New jobs are refused; queued and running work, playback, uploads and cancellation are unaffected. | The balance is paid |
failed_precondition | settlement_unavailable | You asked to pay your outstanding balance mid-cycle on a deployment where that rail is switched off. Nothing about your account is the problem. | An operator enables it |
failed_precondition | nothing_outstanding | You asked to pay an outstanding balance and there is nothing to pay — the everyday result of pressing Pay twice. | More usage accrues |
When an unpaid statement and an over-threshold balance both apply, you get billing_past_due. The statement is the more concrete thing to act on — a real number, an existing Pay action, and a deadline the other does not carry — and you hear about the balance on the very next create once the statement is settled.
ErrorDetails
Each entry in the details array wraps an ErrorDetails message. The entry’s value holds the base64-encoded binary Protobuf of that message, and a sibling debug field carries the same message projected as readable JSON. The code, message, and field_violations fields shown above live under debug — read them there, not under value. The ErrorDetails fields are:
| Field | Type | Description |
|---|---|---|
code | string | The error type: validation_error for a request that breaks the schema, codec_error for a codec option, feature_error for an add-on feature. The specific code of each refusal is on its field violation. |
message | string | Human-readable error description |
field_violations | FieldViolation[] | List of field-level errors (for validation failures) |
FieldViolation
Each field violation points to a specific field in the request:
| Field | Type | Description |
|---|---|---|
field | string | Dot-notation path to the invalid field |
description | string | [<code>] <message>: the specific error code in brackets, then what is wrong with the field. For example [parameter_out_of_range] H.264 CRF must be between 15 and 35. |
Every validator sends this one shape, so read a field’s code the same way whichever check refused it. A refusal that breaks the request schema also carries a validation failed: … message and an x-validation-fields header that lists the failing field paths.
Field paths use dot notation with array indices:
input_url— top-level fieldoutputs[0].type— first output’s type fieldoutputs[0].video[0].h264.crf— nested codec optionmetadata.my_key— metadata entry
Common Error Scenarios
Invalid API Key
{
"code": "unauthenticated",
"message": "Invalid or missing API key"
}Cause: The Authorization header is missing, the key is malformed, the key has been revoked, or the key has expired.
Solution: Check that you are passing a valid API key as Bearer {{API_KEY}} in the Authorization header.
Resource Not Found
{
"code": "not_found",
"message": "Job not found: job_nonexistent123"
}Cause: The resource ID does not exist, or it belongs to a different app.
Solution: Verify the resource ID and ensure you are using the correct API key (keys are scoped to an app).
Validation Error
{
"code": "invalid_argument",
"message": "outputs[0].video[0].h264.crf: H.264 CRF must be between 15 and 35",
"details": [
{
"type": "transcodely.v1.ErrorDetails",
"value": "Cgtjb2RlY19lcnJvchJBb3V0cHV0c1swXS52aWRlb1sw...",
"debug": {
"code": "codec_error",
"message": "outputs[0].video[0].h264.crf: H.264 CRF must be between 15 and 35",
"field_violations": [
{
"field": "outputs[0].video[0].h264.crf",
"description": "[parameter_out_of_range] H.264 CRF must be between 15 and 35"
}
]
}
}
]
}Cause: One or more request fields failed validation.
Solution: Read each field_violation to identify and fix the invalid fields. Switch on the bracketed code at the start of its description, not on the message text. All violations are returned at once so you can fix them in a single pass.
Organization Suspended
{
"code": "permission_denied",
"message": "Organization is suspended"
}Cause: The organization associated with the API key is suspended. The most common reason is an invoice left unpaid for two weeks — see the payment-failure schedule — but an organization can also be suspended deliberately by a person.
Solution: Sign in to the dashboard, which stays readable while an organization is suspended, and settle anything outstanding. Paying lifts a suspension applied for non-payment on the next request. A suspension applied for any other reason is not lifted by paying; contact support.
Quality Tier Not Allowed
{
"code": "invalid_argument",
"message": "this app may only use quality tiers [economy] and output 0 requests "premium" (set by the Starter plan); request an allowed tier or contact support about a plan change"
}Cause: An output — or any variant of an ABR ladder — asked for a quality tier that your plan does not allow. This is always caught at create time, so no job is created and nothing is billed. Note that an output which does not name a tier is a request for standard, not an exemption: on a plan that allows only economy, a bare output is rejected too.
Solution: Request a tier your plan allows, naming it explicitly on every output and every variant. If your workload genuinely needs the tier, contact support about a plan change.
Output Duration Limit Exceeded
{
"code": "invalid_argument",
"message": "this job would encode 142.0 seconds, but a job on this app may encode at most 30 seconds (set by the Starter plan); set a clip of at most 30 seconds, or contact support about a plan change"
}Cause: The job would encode more video than its output duration cap allows. The cap measures the effective encode window — what would actually be encoded — not the raw length of the source, so a clip range inside the cap is fine on a source of any length. The cap comes from one of three places: your plan, the platform default (when no plan sets one), or the free tier, which applies while the organization has no usable payment method or while an invoice is overdue. A refusal at create time names the source in brackets, as in the example (“set by the Starter plan”, “set by the platform default”, “set by the free tier”). A failure at probe time says “the free tier allows” or “your plan allows”; for the platform default it says only “the longest allowed is” the cap.
This limit is enforced in two places, because a source’s length is not always knowable up front. When it is (an explicit clip range, or a source we already have the duration for) the request is rejected outright, as above. When it is not — a URL or origin source with no clip range — the job is accepted and the check runs once the source has been probed. In that case the job moves to failed with error_code output_duration_limit_exceeded and a job.failed webhook fires; its message starts “Output duration limit exceeded:” and gives the numbers.
On the free tier while the organization has no usable payment method, a hosted video (an upload, Create a video from a URL, the CLI or a bulk import) is not refused: its first 2 minutes are encoded and the video carries truncation. A job created with Create a job is still refused, and so is a hosted video on an account with an overdue invoice or over a cap from a plan or the platform default.
Solution: The message ends with the action that changes the outcome:
| Why the cap applies | What the message tells you to do |
|---|---|
| Free tier, no usable payment method | add a payment method in your dashboard’s billing settings to lift the limit, or set a clip that fits (for a hosted video: upload a shorter video) |
| Free tier, an invoice is overdue | pay the overdue invoice in your dashboard’s billing settings to lift the limit, or set a clip that fits (for a hosted video: upload a shorter video) |
| Your plan | set a clip that fits (for a hosted video: upload a shorter video), or contact support about a plan change |
| The platform default | set a clip that fits, or, at create time, contact support about a plan change; at probe time: set a clip that fits (for a hosted video: upload a shorter video), or contact support |
A clip range fits when its encode window is at most the cap; the message names the cap in seconds.
Duplicate Resource
{
"code": "already_exists",
"message": "Preset with slug 'web_720p_fast' already exists"
}Cause: Attempting to create a resource with a slug or identifier that is already in use.
Solution: Use a different slug, or retrieve the existing resource.
State Conflict
{
"code": "failed_precondition",
"message": "Job is not in a cancelable state: completed"
}Cause: The requested operation is not valid for the resource’s current state (e.g., canceling a completed job, confirming a job that is not awaiting confirmation).
Solution: Check the resource’s current status before making state-transition requests.
Error Handling Best Practices
- Always check the
codefield for programmatic error handling — do not parse themessagestring. - Handle all validation errors at once — the API returns every field violation in a single response.
- Retry on
unavailableandresource_exhausted— use exponential backoff with jitter. The official SDKs honorRetry-Afterand retry these automatically. - Do not retry on
invalid_argumentornot_found— these indicate a problem with your request. - Do not retry the billing codes —
billing_past_dueandoutstanding_balance_exceededclear when somebody pays, not when time passes. Surface them to a human instead of backing off. - Log the full error response — including
detailsandfield_violations— for debugging.
SDK error handling
If you use one of the official SDKs, prefer the typed error classes — they give you instanceof / isinstance / errors.As-style matching without parsing strings.
Every error inherits from a base TranscodelyError and exposes the same fields across all three SDKs:
| Class | HTTP status | When |
|---|---|---|
APIConnectionError | — | Network / DNS / TLS failure |
APIError | 5xx | Server-side internal error |
AuthenticationError | 401 | Invalid, missing, or revoked API key |
PermissionError | 403 | Authenticated but lacking permission |
NotFoundError | 404 | Resource doesn’t exist |
ConflictError | 409 | Idempotency conflict, slug taken |
RateLimitError | 429 | Carries retryAfterMs / retry_after_ms / RetryAfter |
InvalidRequestError | 400 / 422 | Carries errors: FieldViolation[] |
PreconditionError | 400 | Wrong state (e.g. job not cancelable) — Connect code failed_precondition |
Every error carries code, httpStatus, requestId, and raw (the original response body) for debugging.
failed_precondition and invalid_argument share HTTP 400, so the status alone does not separate them — switch on the code field when you need to tell them apart. The Go SDK classifies on the Connect code and raises PreconditionError correctly; the TypeScript and Python SDKs currently classify on the HTTP status, so a failed_precondition reaches them as InvalidRequestError.
Without an SDK there are no typed exceptions to catch — instead, inspect the HTTP status and read the structured code and field_violations straight out of the JSON body (e.g. with jq):
# Capture the response body and the HTTP status separately (no -f, so the
# error body is still written to /tmp/resp.json on a 4xx/5xx).
http_status=$(curl -sS -o /tmp/resp.json -w '%{http_code}'
-X POST "https://api.transcodely.com/transcodely.v1.JobService/Create"
-H "Authorization: Bearer {{API_KEY}}"
-H "Content-Type: application/json"
-d '{"input_url": "not-a-url", "outputs": []}')
if [ "$http_status" -ge 400 ]; then
# Top-level Connect code (e.g. "invalid_argument", "not_found").
jq -r '.code, .message' /tmp/resp.json
# Field-level violations, when present (HTTP 400/422).
jq -r '.details[]?.debug.field_violations[]? | "(.field): (.description)"' /tmp/resp.json
fiimport {
TranscodelyError,
AuthenticationError,
NotFoundError,
RateLimitError,
InvalidRequestError,
} from "@transcodely/sdk";
try {
await client.jobs.create(request);
} catch (err) {
if (err instanceof InvalidRequestError) {
for (const v of err.errors) {
console.error(`${v.field}: ${v.description}`);
}
} else if (err instanceof RateLimitError) {
await new Promise((r) => setTimeout(r, err.retryAfterMs ?? 1000));
} else if (err instanceof NotFoundError) {
console.error("not found:", err.message);
} else if (err instanceof AuthenticationError) {
console.error("bad API key");
} else if (err instanceof TranscodelyError) {
console.error(`[${err.requestId}] ${err.code}: ${err.message}`);
} else {
throw err;
}
}import time
from transcodely import (
TranscodelyError,
AuthenticationError,
NotFoundError,
RateLimitError,
InvalidRequestError,
)
try:
client.jobs.create(input_url=..., outputs=[...])
except InvalidRequestError as err:
for v in err.errors:
print(f"{v.field}: {v.description}")
except RateLimitError as err:
time.sleep((err.retry_after_ms or 1000) / 1000)
except NotFoundError as err:
print(f"not found: {err}")
except AuthenticationError:
print("bad API key")
except TranscodelyError as err:
print(f"[{err.request_id}] {err.code}: {err}")import (
"errors"
"time"
"github.com/transcodely/transcodely-go"
)
job, err := client.Jobs.Create(ctx, params)
if err != nil {
var notFound *transcodely.NotFoundError
var invalid *transcodely.InvalidRequestError
var rate *transcodely.RateLimitError
var auth *transcodely.AuthenticationError
switch {
case errors.As(err, ¬Found):
log.Printf("not found, request_id=%s", notFound.RequestID())
case errors.As(err, &invalid):
for _, v := range invalid.Errors() {
log.Printf("%s: %s", v.Field, v.Description)
}
case errors.As(err, &rate):
time.Sleep(rate.RetryAfter)
case errors.As(err, &auth):
log.Fatal("bad API key")
default:
log.Fatal(err)
}
}
_ = jobDirect Connect-RPC error handling
If you call the API without an SDK (e.g. from a generated Connect-ES or connect-go stub), match on the Connect Code directly. The SDK examples above are equivalent — they wrap this code-based matching in typed classes.
There is no public Connect-RPC client library for Python — the official Python SDK speaks Connect over plain HTTP/JSON internally, and there is no low-level ConnectError to catch. If you are not using the SDK from Python, inspect the HTTP status and JSON body directly (see the curl + jq snippet under SDK error handling); otherwise use the SDK’s typed errors shown below.
import { ConnectError, Code } from '@connectrpc/connect';
try {
const job = await client.create(request);
} catch (err) {
if (err instanceof ConnectError) {
switch (err.code) {
case Code.InvalidArgument:
// Parse field violations from err.details
console.error('Validation failed:', err.message);
break;
case Code.NotFound:
console.error('Resource not found');
break;
case Code.Unauthenticated:
// Redirect to login or refresh credentials
break;
case Code.Unavailable:
// Retry with exponential backoff
break;
default:
console.error('Unexpected error:', err.code, err.message);
}
}
}# Python has no low-level Connect client — use the SDK's typed errors instead.
from transcodely import (
InvalidRequestError,
NotFoundError,
AuthenticationError,
APIError,
TranscodelyError,
)
try:
job = client.jobs.create(input_url=..., outputs=[...])
except InvalidRequestError as err:
# Field violations are already parsed for you.
for v in err.errors:
print(f"validation failed: {v.field}: {v.description}")
except NotFoundError:
print("resource not found")
except AuthenticationError:
# Refresh credentials.
...
except APIError:
# 5xx / unavailable — retry with exponential backoff.
...
except TranscodelyError as err:
print(f"unexpected error: {err.code}: {err}")import (
"errors"
"connectrpc.com/connect"
)
// client is a generated connect-go stub, e.g. from
// transcodelyv1connect.NewJobServiceClient(httpClient, "https://api.transcodely.com").
_, err := client.Create(ctx, connect.NewRequest(req))
if err != nil {
var connectErr *connect.Error
if errors.As(err, &connectErr) {
switch connectErr.Code() {
case connect.CodeInvalidArgument:
// Field violations live in connectErr.Details().
log.Printf("validation failed: %v", connectErr.Message())
case connect.CodeNotFound:
log.Print("resource not found")
case connect.CodeUnauthenticated:
// Refresh credentials.
case connect.CodeUnavailable:
// Retry with exponential backoff.
default:
log.Printf("unexpected error: %v: %v", connectErr.Code(), connectErr.Message())
}
}
}