Error Codes

Error Handling

When a request fails, first check the HTTP status code to identify the type of problem, then check the code and message in the response body to pinpoint the specific cause. This document explains what common errors mean, whether they are safe to retry, and the recommended way to handle them.

Error Response Structure

When a request fails, the API typically returns JSON like the following:

json
Copy
{
  "code": 1000,
  "message": "Duration must be between 1 and 6 seconds."
}
FieldTypeDescription
codenumberBusiness error code
messagestringSpecific error description
dataobjectAdditional data; returned when supplementary information is available

Handling Principles

HTTP Status CodeError TypeRetry RecommendedHow to Handle
400Parameter errorNoFix the request parameters and resubmit
401Authentication errorNoCheck the token, signature, expiration time, and request headers
403Permission or credit-package errorNoCheck account entitlements, credit packages, and credits
404Resource not foundNoCheck whether the task_id, batch_id, or resource is incorrect or has expired
429Quota or rate limitingYesVerify entitlement quotas, queue capacity, and concurrency limits; monitor request frequency, and if you find high-frequency access above the limit, consider lowering your request concurrency threshold
500Server errorYesRetry later; if failures persist, contact support

For 429 and transient 5xx errors, we recommend exponential backoff — for example, waiting 2, 4, then 8 seconds — with a maximum retry count. Never auto-retry parameter errors or authentication errors.

Common Error Codes

HTTP Status CodeBusiness CodeDescriptionRecommended Action
200200SuccessRequest succeeded
4001000Parameter information exception.Check message and fix the parameters
4001001Contains sensitive information.Modify the input to remove sensitive or non-compliant content
4011100Authentication Failed.Check whether the token is correct
4011101Authorization header is missing.Add Authorization to the request headers
4011102Authorization not yet valid.Check the token's nbf time; wait for it to take effect or re-issue the token
4011103Authentication has expired.Regenerate the token
4041200Invalid request. The requested resource does not exist or is not available.Check whether the request path, task ID, or resource exists
4041203Batch ID does not exist or has expired.Check whether the batch_id is correct or has expired
4031300Your credit package does not support this video duration.Check whether your credit package supports this duration or has expired
4031301Your credit package does not support this video resolution.Check whether your credit package supports this resolution or has expired
4031302Insufficient credit package.Check your credits or credit-package balance
4291800Insufficient credit quota.Reduce request frequency, increase your quota, or contact support
5005000Internal Server Error.Retry later; if failures persist, contact support

Common Parameter Errors

When the HTTP status code is 400 and the business code is 1000, message describes the specific field problem.

General Parameters

Error MessageCauseResolution
Model name is required.model_name is missing or emptyProvide a valid model name
Prompt is required.prompt is missingProvide a text prompt
Duration must be between 1 and 6 seconds.Video duration is outside the range supported by the endpointSet the duration according to the specific API documentation
Resolution must be 720p or 1080p.Invalid resolution formatUse 720p or 1080p
Aspect ratio must be 16:9, 9:16, or 1:1.Invalid aspect ratioUse an aspect ratio supported by the endpoint
Seed must be between 0 and 10000000.Random seed out of rangeUse an integer between 0 and 10000000
The prompt length must not exceed 10000 characters.Prompt is too longShorten it to within 10,000 characters
The negative prompt length must not exceed 10000 characters.Negative prompt is too longShorten it to within 10,000 characters
The audio prompt length must not exceed 200 characters.Audio prompt is too longShorten it to within 200 characters
The callback url length must not exceed 500 characters.Callback URL is too longShorten it to within 500 characters
Task Id is required.Task ID is missingUse the task_id returned by the create-task endpoint

Images and Reference Inputs

Error MessageCauseResolution
Image URL must be a valid HTTP or HTTPS URLInvalid image URL formatProvide a publicly accessible HTTP/HTTPS URL
Image URL is required.Image URL is missingProvide a valid image URL
Image URL cannot be empty.Image URL is emptyEnsure the URL string is not empty
Image URL list cannot exceed 9 elements.Number of images or reference inputs exceeds the limitKeep the list to at most 9 elements
Reference inputs cannot exceed 9 elements.Number of reference_inputs exceeds the limitProvide at most 9 reference inputs
URL array at index {n} cannot exceed 4 URLs.A URL array exceeds the limitEach array may contain at most 4 URLs
Images array must contain 2 to 4 URLsNumber of subject reference images does not meet the requirementsubject-type inputs require 2 to 4 images of the same subject

File Upload

Error MessageCauseResolution
The upload image list cannot be empty.Upload image list is emptyProvide at least one image
The upload type cannot be empty.upload_type is missingUse url or base64
The upload type can only be url or base64.Invalid upload typeUse a publicly supported upload type
Batch upload supports a maximum of {n} files.Number of batch-upload items exceeds the limitUpload at most 300 images per batch
The {n}th file: imageData cannot be empty.Image data is emptyProvide a valid image URL or Base64 data
The {n}th image URL does not have a valid file extension.URL is missing a valid extensionEnsure the URL contains a supported image extension
The {n}th image URL format '{ext}' is not supported.Unsupported image formatUse a supported image format
The {n}th image (base64) size is approximately {size}MB, exceeds the maximum limit of 10MB.Base64 image is too largeEach image must not exceed 10MB
The {n}th image (base64): Cannot determine image format.Base64 image format cannot be identifiedProvide a format parameter or use a data URL
The upload file list cannot be empty.File list is emptyUpload at least one file
The {n}th file '{filename}' size is {size}MB, exceeds the maximum limit of 10MB.File is too largeEach image must not exceed 10MB
The length of imageNames array must match the length of files array.Number of custom file names does not matchThe number of image_names must match the number of files

Supported image formats: jpg, jpeg, png.

Subject Parameters

Error MessageCauseResolution
Subject name is required.Subject name is missingProvide a valid subject name
The name length must not exceed 50 characters.Subject name is too longShorten it to within 50 characters
The desc length must not exceed 500 characters.Subject description is too longShorten it to within 500 characters
Subject type must be either 'character' or 'object'Invalid subject typeUse character or object

Troubleshooting Suggestions

  • Parameter errors: Check message first, then compare against the parameter description of the corresponding API.
  • Authentication errors: Confirm the token was correctly signed with your AccessKey and SecretKey and has not expired.
  • Task query failures: Confirm you are using the task_id returned by the create-task endpoint; do not mix in IDs from other endpoints.
  • Rate-limit errors: Reduce request frequency, configure exponential backoff and a maximum retry count; verify your entitlement package to confirm whether the quota is exhausted or the entitlement is unavailable.
  • Server errors: Record the request time, endpoint path, task_id, and error response to facilitate follow-up troubleshooting.
Previous
Callbacks
Next
Text to Video
On this page
Error Codes | bach.art | bach.art