ATH-MaaS/Pixelle-Video · error · RuntimeError

万象视频 API 未返回 video_url 或 task_id,无法查询结果: status={rsp.status_

Error message

万象视频 API 未返回 video_url 或 task_id,无法查询结果: status={rsp.status_code}, code={rsp.code}, message={rsp.message}, task_status={task_status}

What it means

After a successful submit (status 200), the client expects either a direct video_url or a task_id to poll asynchronously. If _extract_video_url finds nothing and _extract_task_id also finds nothing, the response is unusable, so this RuntimeError is raised with the full response status/code/message/task_status for diagnosis.

Source

Thrown at pixelle_video/services/api_services/video_dashscope.py:369

                call_kwargs["seed"] = seed

            rsp = self._with_network_retry(
                "submit task",
                lambda: VideoSynthesis.call(**call_kwargs),
            )

        if rsp.status_code != HTTPStatus.OK:
            raise RuntimeError(
                f"万象视频 API 错误: status={rsp.status_code}, "
                f"code={rsp.code}, message={rsp.message}"
            )

        video_url = self._extract_video_url(rsp)
        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}"
                )

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Log the raw rsp output dict to see its actual schema.
  2. Upgrade/downgrade the dashscope SDK to match the response format the client extracts from.
  3. Inspect rsp.code/message embedded in the exception — a business error may hide behind HTTP 200.
  4. Check whether the model returns async-only results and that task extraction keys (output.task_id) match the SDK response.
  5. Bypass proxies/gateways that may rewrite the response body.

Example fix

// before
video = client.generate_video(...)  # RuntimeError: no video_url/task_id
// after
try:
    video = client.generate_video(...)
except RuntimeError as e:
    import dashscope
    print("sdk version:", dashscope.__version__)  # align with client expectations
    logger.debug("raw response: %s", e)
    raise
Defensive patterns

Strategy: try-catch

Validate before calling

import dashscope
assert dashscope.__version__ == PINNED_VERSION, "dashscope SDK version drift"
# submit responses must carry video_url or task_id; verify on a smoke call

Type guard

def response_has_result(rsp) -> bool:
    out = getattr(getattr(rsp, "output", None), "__dict__", {}) or {}
    return bool(out.get("video_url") or out.get("task_id"))

Try / catch

try:
    video = client.generate_video(...)
except RuntimeError as e:
    logger.error("unusable dashscope response: %s", e)  # includes status/code/message/task_status
    raise

Prevention

When it happens

Trigger: The submit response contains neither an output video URL nor a task id — typically an unusual/failed payload shape, a response from an unsupported SDK version, or a truncated/empty output dict despite HTTP 200.

Common situations: dashscope SDK version mismatch producing different response schema than _extract_video_url/_extract_task_id expect; response wrapping changes between model generations; API returning 200 with an error embedded in output; proxy/gateway altering the JSON body.

Related errors


AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30). Data as JSON: /api/errors/20f8e109af20de83. Report an issue: GitHub.