ATH-MaaS/Pixelle-Video · error · RuntimeError
万象视频任务查询失败: status={rsp.status_code}, code={rsp.code}, messa
Error message
万象视频任务查询失败: status={rsp.status_code}, code={rsp.code}, message={rsp.message}, task_id={task_id} What it means
For async submissions, the client polls VideoSynthesis.wait() (wrapped with retries, max_attempts=8, base_delay=5s). If the final polled response has a non-OK status_code, this RuntimeError is raised with the HTTP status, API code/message, and the task_id so the failed task can be traced in the DashScope console.
Source
Thrown at pixelle_video/services/api_services/video_dashscope.py:383
if not video_url:
task_id = self._extract_task_id(rsp)
task_status = self._extract_task_status(rsp)
if not task_id:
raise RuntimeError(
"万象视频 API 未返回 video_url 或 task_id,无法查询结果: "
f"status={rsp.status_code}, code={rsp.code}, message={rsp.message}, "
f"task_status={task_status}"
)
logger.info(f"DashscopeVideoClient: 任务已提交 task_id={task_id}, status={task_status}; 等待生成完成...")
rsp = self._with_network_retry(
f"wait task {task_id}",
lambda: VideoSynthesis.wait(task=rsp, api_key=self.api_key),
max_attempts=8,
base_delay=5.0,
)
if rsp.status_code != HTTPStatus.OK:
raise RuntimeError(
f"万象视频任务查询失败: status={rsp.status_code}, "
f"code={rsp.code}, message={rsp.message}, task_id={task_id}"
)
video_url = self._extract_video_url(rsp)
task_status = self._extract_task_status(rsp)
if not video_url:
raise RuntimeError(
"万象视频任务完成后仍未返回 video_url: "
f"code={rsp.code}, message={rsp.message}, task_id={task_id}, task_status={task_status}, "
f"output={self._safe_output_repr(rsp)}"
)
logger.info(f"DashscopeVideoClient: 视频生成成功: {video_url}")
# 确保输出目录存在
os.makedirs(os.path.dirname(save_path), exist_ok=True)
View on GitHub (pinned to 848b054e4f)
Solutions
- Use the task_id from the error to query the task status/details directly in the DashScope console or via the query API.
- Read the embedded code/message for the concrete cause (auth vs task-failed vs throttling).
- Re-submit the task if it failed terminally; check moderation/billing causes first.
- Increase polling tolerance (max_attempts/base_delay) for long-running models if timeouts are the cause.
- Verify the same valid api_key is used for submit and wait calls.
Example fix
// before
video = client.generate_video(...) # RuntimeError on wait
// after
try:
video = client.generate_video(...)
except RuntimeError as e:
task_id = extract_task_id_from(str(e)) # from error text
logger.error("task %s failed, check dashscope console", task_id)
raise Defensive patterns
Strategy: retry
Validate before calling
# before submitting long tasks, confirm API key and quota are healthy
if not os.environ.get("DASHSCOPE_API_KEY"):
raise ValueError("DASHSCOPE_API_KEY not set") Type guard
def wait_rsp_ok(rsp) -> bool:
return getattr(rsp, "status_code", None) == 200 Try / catch
try:
video = client.generate_video(...)
except RuntimeError as e:
# extract task_id from message and query console/API for final status
logger.error("dashscope task wait failed: %s", e)
raise Prevention
- Record task_id from logs at submit time for later diagnosis.
- Use the same, valid api_key for submit and polling.
- Allow generous polling windows for long renders; the client waits max_attempts=8 with 5s base delay.
- Investigate embedded code/message to distinguish terminal task failure from transient poll errors.
When it happens
Trigger: Polling task {task_id} ends with a non-200 response: query-auth failure, task record expired/unknown, service error during wait, or quota/billing rejection surfacing at poll time.
Common situations: Task failed server-side (rendering error, content moderation) and the wait response reflects it; API key rotated between submit and wait; task submitted long ago so the record aged out; transient DashScope outages exceeding the 8 retry attempts.
Related errors
- rsp.code
- 万象视频 API 未返回 video_url 或 task_id,无法查询结果: status={rsp.status_
- 万象视频任务完成后仍未返回 video_url: code={rsp.code}, message={rsp.messa
- 可灵查询 API 错误: code={data.get('code')}, message={data.get('mes
- 可灵视频生成超时 (task_id={task_id}, 已等待 {self.max_polls * self.poll
AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30).
Data as JSON: /api/errors/c1c198634e65750a.
Report an issue: GitHub.