Error Codes

Error Handling

When a request fails, check both the HTTP status code and the code and message in the response body. These are not the same concept: some business exceptions in the current service are returned with HTTP 200, but the code in the response body is not 200, in which case the request has still failed.

Response Structure

An error response is typically:

json
Copy
{
  "code": 1000,
  "message": "Duration must be between 1 and 8 seconds. Please refer to the API documentation for details."
}

Some errors additionally return data:

json
Copy
{
  "code": 1000,
  "message": "Parameter information exception",
  "data": {}
}
FieldTypeDescription
codenumberBusiness error code; you cannot judge business success from the HTTP status alone
messagestringSpecific error description; success responses usually omit this field
dataany JSON typeOptional additional information; not fixed as an object
timestampnumberUnix timestamp in seconds returned by some normal business responses; not guaranteed on errors

The business code for a successful response is 200. When the generic business response object is used, successful responses usually do not return message: "Success".

HTTP Status and Handling Principles

HTTP StatusMeaning in the current codeRetry as-is recommendedRecommended Action
200May be success, or a business failure produced by BizException/RespErrorExceptionDepends on response bodyMust continue checking code in the response body; only code = 200 indicates success
400Bean Validation parameter validation failure, explicit parameter exception, or sensitive contentNoCorrect the field, format, range, or content according to message
401Token missing, malformed/invalid signature, not yet valid, or expiredNoCorrect or re-issue the Token
402Insufficient resource-package credits (business code 1302)NoTop up available credits/resource packages before resubmitting
403Current resource package does not support the requested resolution (business code 1301)NoUse one of the available resolutions listed in the response, or adjust the resource package
403CloudFront Geo edge rules deny access, returning code = 403, message = "Access denied"; this response does not go through the Java business error systemNoCheck whether the source IP, region, and AccessKey comply with the access rules
404Task, subject, batch, or other resource does not exist or has expired (usually business code 1200)NoCheck the ID, owning account, and whether the resource has expired
405Request method not supportedNoSwitch to an HTTP method listed in the response message
429The user's pending/processing task count or queue count has reached the limit (business code 1800)Yes, after capacity is releasedRetry after existing tasks complete; use exponential backoff and avoid immediate high-frequency retries
500Unhandled server-side exception; the current generic response is usually code = 500, message = "响应错误"YesRetry a limited number of times later; if failures persist, record the endpoint, request time, and task ID and contact support

Note: business code 5000 is usually returned with HTTP 200 via the business exception handler, and is not equivalent to HTTP 500; the special path of an internal save failure in batch upload returns HTTP 400 with business code 5000. Clients must judge by the response body code.

For temporary errors — 429, 500, and HTTP 200 with business code 5000 — you can use exponential backoff with random jitter, for example 2 seconds, 4 seconds, 8 seconds, with a maximum retry count. Do not automatically retry parameter, authentication, insufficient-credit, entitlement-unsupported, or resource-not-found errors.

Currently Effective Main Business Error Codes

Common HTTP StatusBusiness CodeCurrent Accurate MeaningRecommended Action
200200Request succeeded; success responses usually omit messageContinue processing data
4001000Parameter validation failed. message may be generic copy, or may point to a specific field, format, or rangeCorrect the request per message; do not handle it as a single fixed cause
4001001Text, image, audio, or video content failed the content safety checkModify or replace the relevant input content
4011100Token malformed, signature invalid, issuer/key invalid, or Token parsing failedRegenerate the Token with a valid AccessKey/SecretKey, and confirm the Token is not truncated or tampered with
4011101Authorization missing, empty, or only an empty Bearer prefix was passedPass a non-empty Token; the service accepts both a bare Token and Bearer <token>
4011102The Token's nbf time has not yet arrivedCalibrate the client clock and wait for the Token to become valid, or re-issue it
4011103The Token has passed its exp expiration timeRegenerate the Token
4041200The requested task, subject, batch-upload batch, or other resource does not exist or is unavailableVerify the returned ID, account ownership, and validity period
4031301The current resource package does not support the requested resolution; message may include Available resolutions: [...]Use an available resolution or adjust the resource package
4021302Insufficient available resource-package creditsTop up credits/resource packages and resubmit
4291800The current user's pending/processing task count or queue occupancy has reached the configured limit; the fixed English copy in the code is Insufficient credit quota., but the actual trigger condition is the task/queue capacity limitBack off and retry after existing tasks complete; do not treat it as insufficient credit balance — insufficient credits correspond to 1302
200 (special batch-upload path: 400)5000The business flow caught a system exception; the fixed copy is usually System busy, please try again.Retry a limited number of times with backoff; contact support if failures persist
200500External service call failed or errored; because BizException is used, HTTP may still be 200, with copy usually 调用服务失败!, 调用服务异常!, etc.Retry a limited number of times with backoff; contact support if failures persist
500500Unhandled runtime/system exception; the generic copy is usually 响应错误Retry a limited number of times with backoff; contact support if failures persist
200902 / 903Internal JSON parsing or data processing exception; message may concatenate exception detailsUsually cannot be fixed by retrying the same parameters; record the full response and contact support

Framework-Layer and Edge-Layer Errors

HTTP StatusResponse Body CodeCurrent Trigger ConditionRecommended Action
400400URL/query parameters cannot be converted to the Java type required by the controllerCorrect the parameter type
400404Method-level constraint validation failed or the code threw IllegalArgumentException; this is the HTTP-vs-business-code mismatch caused by the current GlobalVar.Status_BadRequest = 404Correct the parameters according to message
404404No matching route (when NoHandlerFoundException is enabled)Check the URL
405405HTTP method not supportedUse a supported method listed in message
403403Geo edge access rules deny access, message = "Access denied"Check the source IP, region, and AccessKey allowlist

Items Defined in the Code That Should Not Be Handled as Currently Effective Errors on Their Own

  • 1203 is not defined on the server side. When a batch-upload batch does not exist or has expired, the actual response is HTTP 404 with business code 1200, and message is Batch ID does not exist or has expired..
  • Although 1300 is defined in the enum as "unsupported video duration", the current duration-entitlement validation code has been commented out and has no effective throw path. Duration format/range errors usually return HTTP 400 with business code 1000.
  • 1500 and 1501 are only defined in the enum; there is currently no effective usage point in the code.
  • 1004~1009 are Java enum constant names, not independent business codes; their numeric values are all 1000.

Common Parameter/Request Errors (Business Code 1000)

Bean Validation and ParamException usually return HTTP 400 with code = 1000; however, some query and business services use BizException and return the same business code with HTTP 200, and a few paths for a non-existent model even return code = 1000 with HTTP 404. message carries the actual semantics. The content below preserves the server's actual English copy so clients can match logs; we do not recommend that clients rely on the full copy for business branching.

Basic Fields

Error MessageActual MeaningResolution
Please provide a prompt. / Prompt is required. / Name is required.The endpoint requires a prompt, but prompt is missing or empty; the reference-input endpoint's current actual copy is Name is required.Provide a non-empty prompt
The prompt length must not exceed 10000 characters.The general prompt exceeds 10,000 Chinese/English charactersShorten the prompt
Prompt length must be between 1 and 5000 characters.The Montage prompt is empty or exceeds 5,000 Chinese/English charactersKeep the Montage prompt between 1 and 5,000 Chinese/English characters
The negative prompt length must not exceed 10000 characters.The negative prompt exceeds 10,000 Chinese/English charactersShorten the negative prompt to within 10,000 Chinese/English characters
The audio prompt length must not exceed 200 characters.The audio prompt exceeds 200 Chinese/English charactersShorten it to within 200 Chinese/English characters
The callback url length must not exceed 500 characters.The callback URL exceeds 500 charactersShorten the callback URL
Callback URL must be a valid HTTP or HTTPS URL / Callback must be a valid HTTP or HTTPS URLThe callback URL does not match the current HTTP/HTTPS URL regexUse a complete, accessible HTTP/HTTPS URL
Task Id is required. Please refer to the API documentation for details.task_id is empty when querying a taskUse the task ID returned by the create endpoint
FPS must be 24. Please refer to the API documentation for details.The general video endpoint's frame rate is not supportedUse 24

Duration Limits

Duration is not a uniform 1~6 seconds. The current code validates by endpoint, model, and input method:

Endpoint/ScenarioCurrent LimitTypical Error Message
General Text to Video1~8 secondsDuration must be between 1 and 8 seconds...
bach-1.0 Image to Video, first frame only1~8 secondsFor bach-1.0: first frame only 1-8s...
bach-1.0 Image to Video, last frame only or first and last frames1~6 secondsSame as above
Reference inputs, model_name = bach-1.01~8 secondsWhen model_name is bach-1.0 duration must be 1-8 seconds...
MontageOnly 10, 15, 20, 25, 30, 45 secondsDuration must be one of: 10, 15, 20, 25, 30, 45 seconds.

Resolution and Aspect Ratio

Error MessageActual MeaningResolution
Resolution must be 720p or 1080p...Most video endpoints only accept lowercase 720p or 1080pUse a value supported by the endpoint
Aspect ratio must be 16:9, 9:16, or 1:1...The aspect ratio for general Text to Video, reference inputs, or Montage is not supportedUse 16:9, 9:16, or 1:1

Images, Audio, and Reference Inputs

Error MessageActual MeaningResolution
Image URL is required. / Image URL cannot be empty or blank.A required image URL is missing or emptyProvide a non-empty image URL
Image URL must be a valid HTTP or HTTPS URL.The image URL failed the current format validationProvide a complete HTTP/HTTPS URL
End image URL must be a valid HTTP or HTTPS URL.The last-frame URL format is invalidProvide a complete HTTP/HTTPS URL
Image URL is required, or at least one of image_url and end_image_url for bach-1.0.Neither the first nor the last frame was provided for bach-1.0Provide at least the first or last frame for bach-1.0
Reference inputs are required... / Reference inputs cannot be empty...reference_inputs is missing or the list is emptyProvide at least one reference input
Reference inputs cannot exceed 9 elements...reference_inputs has more than 9 top-level elementsProvide at most 9 reference inputs
Images array must contain 2 to 4 URLsThe subject reference image count for type = subject is not between 2 and 4Provide 2~4 images for that subject
Image URL is requiredThe url for type = image is emptyProvide a non-empty image URL

Subject Parameters

Error MessageActual MeaningResolution
Subject name is required... / Name is required...The subject name is emptyProvide a non-empty name
The name length must not exceed 50 characters. / Name must be between 1 and 50 characters...The subject name exceeds 50 Chinese/English characters, or is emptyKeep it between 1 and 50 Chinese/English characters
The desc length must not exceed 1000 characters. / Description must be between 1 and 1000 characters...The subject description exceeds 1000 Chinese/English characters; some endpoints require it to be non-empty if providedKeep it between 1 and 1000 Chinese/English characters per the endpoint
Subject type must be either 'character' or 'object'...subject_type is invalidUse character or object
Style must be one of: realistic, anime, cartoon, 3d, pixel...subject_style is invalidUse one of the five listed styles
URLs must contain between 1 and 4 URLs...The subject-creation endpoint's image count is not between 1 and 4Provide 1~4 images

Batch File Upload

JSON batch upload supports upload_type = url | base64 。url/base64` images: up to 300 per batch, up to 10 MB each. The specific limits come from the service configuration and may be adjusted per deployment; the numbers in dynamic error messages take precedence.

Error MessageActual MeaningResolution
The upload file list cannot be empty.The images/files list is empty, or the multipart request has no filesProvide at least one file
The upload type cannot be empty.upload_type is missingUse url, base64
The upload type can only be url, base64.The upload type is not supportedUse one of the two listed types
Batch upload supports a maximum of {n} files.The JSON image upload count exceeds the current configured limitKeep the batch size within the limit in the message
The {n}th file: imageData cannot be empty.The nth JSON upload item has no file dataProvide a URL or Base64 data
The {n}th image URL does not have a valid file extension. Supported formats: ...The image URL path has no recognizable extensionUse a URL with a supported extension
The {n}th image URL format '{ext}' is not supported. Supported formats: ...The image URL extension is not supportedUse an image format listed in the error message
The {n}th image (base64): Cannot determine image format...No format, and the data lacks a data:image/... prefixProvide format or a standard data URL
The {n}th image (base64): Invalid Base64 data format.The Base64 cannot be decodedCorrect the Base64 data
The {n}th file (base64) size is approximately {size}MB, exceeds the maximum limit of 10MB.The Base64 image's estimated decoded size exceeds 10 MBCompress the image or split the upload
The length of imageNames array must match the length of files array.The image_names count does not match the multipart files countKeep the two arrays in one-to-one correspondence

Image extensions currently supported by the batch-upload controller: jpg, jpeg, png.

Resource Query Errors

HTTP / Business CodeError MessageActual MeaningResolution
404 / 1200Invalid request. The requested resource does not exist or is not availableThe task or subject does not exist, or the current user cannot query this resourceUse the ID returned by the create endpoint, and confirm the same account is used
404 / 1200Batch ID does not exist or has expired.The batch-upload status was not found in Redis; the ID may be wrong or the status expiredVerify the batch_id; if expired, resubmit the batch

Troubleshooting Checklist

  1. Check the HTTP status first, then the response body code; HTTP 200 does not necessarily mean success.
  2. When code = 1000, go by the specific field indicated in message; do not apply a uniform duration, resolution, or seed range.
  3. When code = 1100~1103, check Authorization, Token integrity, the signing key, and the client clock.
  4. code = 1302 means insufficient credits; code = 1800 in the current implementation means the queue/concurrent-task capacity is full — the two are handled differently.
  5. When querying a task, subject, or batch, confirm the ID comes from the corresponding create endpoint, and that creation and querying use the same account.
  6. When encountering 429, HTTP 500, or business code 5000, record the request time, endpoint path, task ID, and full response, then perform a limited number of backoff retries.
Previous
Callbacks
Next
Text to Video
On this page
Error Codes | bach.art | bach.art