Skip to main content
LocoPal AiLocoPal Ai
API Integration

Guide

Error Codes and Troubleshooting

HTTP statuses, error code meanings, common model and asset errors, rate limiting, and troubleshooting steps

View Markdown

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

StatusMeaningHandling
200Request succeeded (intermediate states of async tasks are also 200)Read the status field in the response body
400Parameter error, malformed request body, or missing modelFix the request according to error.message or msg
401API key missing, incorrect, or expiredCheck Authorization and the key's status
403Permission denied (for example, accessing another account's assets)Confirm the resource belongs to the current account
404Resource does not exist, does not belong to the current account, or the method does not matchVerify the ID; if the path is correct, confirm the HTTP method
429Requests too frequentRetry with backoff; do not retry concurrently
500Platform internal errorRecord the request identifier and retry; contact support if failures persist
502Asset processing failed or a dependent service is abnormalRetry 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:

SituationObserved behavior
Resource does not exist / does not belong to the current accountGET /api/v1/materials/assets/<nonexistent> → 404
Sending a GET to a path that only supports POSTGET /v1/chat/completions → 404; GET /v1/images/generations → 404
Path misspelled404

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:

RequestObserved statusResponse body
GET /v1/video/generations/<nonexistent>400{"code":"task_not_exist","message":"task_not_exist","data":null}
GET /v1/videos/<nonexistent>400Same 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"
  }
}
FieldDescription
codeError code; may be an empty string (see below)
messageHuman-readable reason; usually contains a request id
typeError type identifier. Authentication failures, missing models, and invalid request bodies were all observed as new_api_error
paramPresent only for parameter errors; indicates which field

code may be an empty string. Observed: code is "" both for authentication failures and for request bodies whose JSON cannot be parsed. Do not use whether code is empty to decide "whether this is an error"; rely on the HTTP status code and read message first.

type is not a stable classification field. When you need to classify errors, read code and do not rely on the value of type.

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 / messageCauseHandling
Model name not specifiedRequest body is missing the model fieldAdd the model ID from /v1/models
model_not_foundThe model ID does not exist, or the current key / group does not have this modelQuery /v1/models again and use the returned id
No available channelThe current group has no available channelSwitch to a model of the same kind or contact platform support
invalid_parameterThe parameter combination is not supported by the current modelAdjust size, ratio, duration, etc. according to the param field
unknown_parameterThe 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_errorThe 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_quotaThe current upstream channel has no available balanceSwitch to a model / channel of the same kind, or contact platform support to top up the channel balance
ResourceDownloadFailedThe reference image / video URL cannot be downloaded directlyUse a publicly accessible HTTPS URL, or switch to the asset library asset://
task_not_existThe queried task ID does not exist or does not belong to the current accountVerify the task ID and the account that created the task
video_generation_failedThe video task was accepted, but ultimately failed at the upstream submission, asset processing, moderation, or generation stageRead 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 libraryA portrait asset was submitted to a model that does not have that capabilitySwitch to a model that supports the portrait asset library; do not bypass it with a regular image URL
insufficient_user_quotaThe account balance or current API key quota is insufficient to cover the estimated consumption of this requestTop 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 descriptionAdd a prompt, or add a text element to content
content[0].role 不支持 ...The reference asset role is not in the allowed listUse reference_image, first_frame, last_frame, reference_video, or reference_audio
素材库中找不到素材 ...The asset:// asset does not exist or does not belong to the current accountSubmit the asset first and wait until its status is available, or verify the account
task_concurrency_exceededThe 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

HTTPMessageCauseHandling
400请求体必须是 JSON 对象Request body is not valid JSONFix the request body
400type 只能是 virtual 或 realInvalid type valueFix type
400素材分组名称不能为空 / 不能超过 64 个字符Name missing or too longFix the name
400素材分组说明不能超过 300 个字符Description too longShorten the description
400缺少 group_idNo group provided when submitting an assetAdd group_id
400image_url 必须是可公开下载的 http(s) 地址…The URL is not http(s) or is incompleteUse a public http(s) URL, or switch to data_url
400image_url 与 data_url 只能提交一个Both were submitted, or neither wasKeep only one field
400data_url 必须是 data:image/...;base64,... 格式 / 图片数据无效或超过 20MBUpload data is malformed or too largeFix 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 accountUse the asset_id returned when the asset was submitted
404素材分组不存在或无权访问 / 素材分组不存在或不属于当前账号The group ID is wrong or does not belong to the current accountUse a group ID under your own account
404素材分组不存在或不是虚拟素材分组An image was submitted to a real groupImages can only be submitted to virtual groups
429Requests too frequentPolling too fast or concurrency too highBack off and retry as instructed
500 / 502 / 503素材服务暂不可用The asset service is abnormal or the capability is not enabledRetain 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

MessageCauseHandling
Authorization session does not exist or access deniedThe session expired, was already used, or belongs to another userHave the current user create a new QR code
Authorization not yet completedThe user has not finished capturing on their phoneKeep the QR code and resolve it after completion
This portrait asset is already bound to another userThe same portrait group cannot be reused across accountsUse the originally bound account, or have the person re-authorize
Asset service temporarily unavailableThe authorization channel is currently unavailableRecord the request time and contact platform support; do not substitute portrait capture with a regular image upload

Rate limiting and retries

  • 429 means 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 429 and brief 5xx; for 400 / 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

  1. Is Authorization set to Bearer <API Key>, and is the key still enabled;
  2. Is the request domain the address currently specified in the console (default https://locopalai.com; overseas models may use https://us-api.locopalai.com);
  3. Does model come from data[].id in /v1/models;
  4. Is the asset status already Active;
  5. Is the reference image / video URL a publicly accessible http(s) address that does not depend on cookies or Referer;
  6. 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.
Was this page helpful?

On this page