Guide
Error Codes and Troubleshooting
HTTP statuses, error code meanings, common model and asset errors, rate limiting, and troubleshooting steps
Error Codes and Troubleshooting
When troubleshooting, first record: the HTTP status code, the request identifier returned by the platform, the model ID, task ID, asset ID, and the original error code.
Do not record the API key, portrait session token, or full asset download URLs; redact them before submitting to platform support.
HTTP status meanings
| Status | Meaning | Handling |
|---|---|---|
200 | Request succeeded (intermediate states of async tasks are also 200) | Read the status field in the response body |
400 | Parameter error, malformed request body, or missing model | Fix the request according to error.message or msg |
401 | API key missing, incorrect, or expired | Check Authorization and the key's status |
403 | Permission denied (for example, accessing another account's assets) | Confirm the resource belongs to the current account |
404 | Resource does not exist, does not belong to the current account, or the method does not match | Verify the ID; if the path is correct, confirm the HTTP method |
429 | Requests too frequent | Retry with backoff; do not retry concurrently |
500 | Platform internal error | Record the request identifier and retry; contact support if failures persist |
502 | Asset processing failed or a dependent service is abnormal | Retry later; contact support if failures persist |
404 has three causes; don't always assume "the ID is wrong"
This is the most commonly misjudged point during troubleshooting:
| Situation | Observed behavior |
|---|---|
| Resource does not exist / does not belong to the current account | GET /api/v1/materials/assets/<nonexistent> → 404 |
Sending a GET to a path that only supports POST | GET /v1/chat/completions → 404; GET /v1/images/generations → 404 |
| Path misspelled | 404 |
When you get a 404, first confirm whether the path and method match, then suspect the ID.
A missing video task returns 400, not 404
This is inconsistent with other APIs and requires special attention:
| Request | Observed status | Response body |
|---|---|---|
GET /v1/video/generations/<nonexistent> | 400 | {"code":"task_not_exist","message":"task_not_exist","data":null} |
GET /v1/videos/<nonexistent> | 400 | Same as above |
GET /api/v1/materials/assets/<nonexistent> | 404 | {"code":404,"data":null,"msg":"素材不存在或无权访问"} |
Video task queries return 400 with a top-level {code, message, data} structure,
which is neither 404 nor the error object structure described below.
Error responses have three structures
1. Model / image / video generation APIs — error object
On failure, the API returns a non-2xx HTTP status with an error object:
{
"error": {
"code": "invalid_parameter",
"message": "请求参数不符合所选模型要求",
"type": "invalid_request_error",
"param": "size"
}
}| Field | Description |
|---|---|
code | Error code; may be an empty string (see below) |
message | Human-readable reason; usually contains a request id |
type | Error type identifier. Authentication failures, missing models, and invalid request bodies were all observed as new_api_error |
param | Present only for parameter errors; indicates which field |
codemay be an empty string. Observed:codeis""both for authentication failures and for request bodies whose JSON cannot be parsed. Do not use whethercodeis empty to decide "whether this is an error"; rely on the HTTP status code and readmessagefirst.
typeis not a stable classification field. When you need to classify errors, readcodeand do not rely on the value oftype.
2. Asset library APIs — top-level code
Returns a non-2xx HTTP status, with code matching the HTTP status:
{ "code": 404, "data": null, "msg": "素材不存在或无权访问" }3. Video task queries — top-level code string
{ "code": "task_not_exist", "message": "task_not_exist", "data": null }Note that code here is the string task_not_exist, not a number.
request id: the key identifier for troubleshooting
The platform writes the request id directly into error.message; you do not need to look for it in the headers:
"message": "Invalid token (request id: 202609221135501066578648268d9d6uXuM5QgH)"Extract it with a single command:
curl -s "$LOCOPAL_BASE_URL/v1/models" \
-H "Authorization: Bearer sk-invalid" \
| grep -oE 'request id: [A-Za-z0-9]+'Including this request id when filing a ticket can significantly shorten the time needed to locate the issue.
Authentication failures
When the API key is missing, incorrect, or expired, all APIs return HTTP 401 and:
{
"error": {
"code": "",
"message": "Invalid token (request id: ...)",
"type": "new_api_error"
}
}Note that code is an empty string — this is exactly why we warned above not to rely on code.
Model and generation errors
| Error code / message | Cause | Handling |
|---|---|---|
Model name not specified | Request body is missing the model field | Add the model ID from /v1/models |
model_not_found | The model ID does not exist, or the current key / group does not have this model | Query /v1/models again and use the returned id |
No available channel | The current group has no available channel | Switch to a model of the same kind or contact platform support |
invalid_parameter | The parameter combination is not supported by the current model | Adjust size, ratio, duration, etc. according to the param field |
unknown_parameter | The current model / channel does not recognize a request field (for example, response_format on the image API) | Remove unsupported fields according to param and use the model's default behavior |
InvalidParameter / upstream_error | The upstream model rejected a parameter (for example, the image minimum pixel count is not met) | Read message and adjust the size or parameters |
credit_balance_exhausted / insufficient_quota | The current upstream channel has no available balance | Switch to a model / channel of the same kind, or contact platform support to top up the channel balance |
ResourceDownloadFailed | The reference image / video URL cannot be downloaded directly | Use a publicly accessible HTTPS URL, or switch to the asset library asset:// |
task_not_exist | The queried task ID does not exist or does not belong to the current account | Verify the task ID and the account that created the task |
video_generation_failed | The video task was accepted, but ultimately failed at the upstream submission, asset processing, moderation, or generation stage | Read error.message in the same response; keep the task ID, and have the user resubmit after fixing the asset or parameters |
| The current model does not support the portrait asset library | A portrait asset was submitted to a model that does not have that capability | Switch to a model that supports the portrait asset library; do not bypass it with a regular image URL |
insufficient_user_quota | The account balance or current API key quota is insufficient to cover the estimated consumption of this request | Top up or adjust parameters according to "estimated for this request / currently available" in the error and retry; no task is created in this case |
缺少提示词:请在 prompt 或 content 的 text 元素中提供文本描述 | The video task has no text description | Add a prompt, or add a text element to content |
content[0].role 不支持 ... | The reference asset role is not in the allowed list | Use reference_image, first_frame, last_frame, reference_video, or reference_audio |
素材库中找不到素材 ... | The asset:// asset does not exist or does not belong to the current account | Submit the asset first and wait until its status is available, or verify the account |
task_concurrency_exceeded | The number of generation tasks currently being processed by this account or the platform has reached the concurrency limit (HTTP 429) | Wait for existing tasks to finish according to "currently N / limit M" in the message before submitting; do not retry repeatedly |
Asset library errors
| HTTP | Message | Cause | Handling |
|---|---|---|---|
400 | 请求体必须是 JSON 对象 | Request body is not valid JSON | Fix the request body |
400 | type 只能是 virtual 或 real | Invalid type value | Fix type |
400 | 素材分组名称不能为空 / 不能超过 64 个字符 | Name missing or too long | Fix the name |
400 | 素材分组说明不能超过 300 个字符 | Description too long | Shorten the description |
400 | 缺少 group_id | No group provided when submitting an asset | Add group_id |
400 | image_url 必须是可公开下载的 http(s) 地址… | The URL is not http(s) or is incomplete | Use a public http(s) URL, or switch to data_url |
400 | image_url 与 data_url 只能提交一个 | Both were submitted, or neither was | Keep only one field |
400 | data_url 必须是 data:image/...;base64,... 格式 / 图片数据无效或超过 20MB | Upload data is malformed or too large | Fix the data or switch to image_url |
404 | 素材不存在或无权访问 | The asset ID is wrong, the asset was deleted, or it does not belong to the current account | Use the asset_id returned when the asset was submitted |
404 | 素材分组不存在或无权访问 / 素材分组不存在或不属于当前账号 | The group ID is wrong or does not belong to the current account | Use a group ID under your own account |
404 | 素材分组不存在或不是虚拟素材分组 | An image was submitted to a real group | Images can only be submitted to virtual groups |
429 | Requests too frequent | Polling too fast or concurrency too high | Back off and retry as instructed |
500 / 502 / 503 | 素材服务暂不可用 | The asset service is abnormal or the capability is not enabled | Retain the request information and retry; contact support if failures persist |
An asset still under review is not an error: the query returns 200 with status of Processing; keep polling the same asset ID.
Empty output from a reasoning model is also not an HTTP error: if the response is 200, finish_reason is length, and usage.completion_tokens_details.reasoning_tokens has used up the output limit, increase the output quota or switch to a non-reasoning model.
Portrait authorization errors
| Message | Cause | Handling |
|---|---|---|
| Authorization session does not exist or access denied | The session expired, was already used, or belongs to another user | Have the current user create a new QR code |
| Authorization not yet completed | The user has not finished capturing on their phone | Keep the QR code and resolve it after completion |
| This portrait asset is already bound to another user | The same portrait group cannot be reused across accounts | Use the originally bound account, or have the person re-authorize |
| Asset service temporarily unavailable | The authorization channel is currently unavailable | Record the request time and contact platform support; do not substitute portrait capture with a regular image upload |
Rate limiting and retries
429means requests are too frequent; back off and retry as instructed, and do not retry concurrently;- For asset status, query every 5–10 seconds; for video tasks, every 5–15 seconds;
- Retry only on
429and brief5xx; for400/401/403/404, fix the request directly; - Before retrying, query by task ID / asset ID to avoid duplicate creation and duplicate charges.
Quick self-check
- Is
Authorizationset toBearer <API Key>, and is the key still enabled; - Is the request domain the address currently specified in the console (default
https://locopalai.com; overseas models may usehttps://us-api.locopalai.com); - Does
modelcome fromdata[].idin/v1/models; - Is the asset
statusalreadyActive; - Is the reference image / video URL a publicly accessible
http(s)address that does not depend on cookies or Referer; - Has the same task / asset been submitted more than once.
What to include when contacting support
- Request time and API path;
- HTTP status code and the full response body (with the API key redacted);
- The request identifier, task ID, or asset ID returned by the platform;
- The model ID and parameters involved;
- A minimal reproducible request example.
