ATH-MaaS/Pixelle-Video · error · RuntimeError

rsp.code

rsp.code

Error message

万象视频 API 错误: status={rsp.status_code}, code={rsp.code}, message={rsp.message}

What it means

After VideoSynthesis.call() returns, the client checks rsp.status_code == HTTPStatus.OK. Any non-OK status is converted into a RuntimeError carrying the HTTP status, the DashScope business error code, and the API message. This surfaces server-side rejections (auth, quota, invalid params, content moderation) from the 万象视频/DashScope API.

Source

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

                call_kwargs["negative_prompt"] = negative_prompt
            if resolution:
                call_kwargs["resolution"] = resolution
            if video_ratio:
                call_kwargs["ratio"] = video_ratio
            if prompt_extend is not None:
                call_kwargs["prompt_extend"] = prompt_extend
            if watermark is not None:
                call_kwargs["watermark"] = watermark
            if seed is not None:
                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}",

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Read rsp.message/rsp.code in the exception text — it names the concrete API rejection reason.
  2. Verify DASHSCOPE_API_KEY validity, workspace, and billing/quota status in the DashScope console.
  3. Ensure media URLs are publicly reachable (or use base64/uploaded URLs) — DashScope must download them.
  4. Retry only if the message indicates transient throttling/service error; fix params otherwise.
  5. Confirm the model name is still supported in your region/SDK version.

Example fix

// before
video = client.generate_video(model=model, prompt=p, image_path=img)  # surfaces RuntimeError
// after
try:
    video = client.generate_video(model=model, prompt=p, image_path=img)
except RuntimeError as e:
    logger.error("dashscope submit failed: %s", e)  # inspect code/message
    raise
Defensive patterns

Strategy: try-catch

Validate before calling

if not os.environ.get("DASHSCOPE_API_KEY"):
    raise ValueError("DASHSCOPE_API_KEY not set")
# ensure referenced media URLs are publicly reachable
for url in media_urls:
    if url.startswith("http") and not is_publicly_fetchable(url):
        raise ValueError(f"media URL not reachable by dashscope: {url}")

Type guard

def submit_rsp_ok(rsp) -> bool:
    return getattr(rsp, "status_code", None) == 200

Try / catch

try:
    video = client.generate_video(...)
except RuntimeError as e:
    # message contains status/code/message from dashscope
    if "Throttling" in str(e) or "429" in str(e):
        time.sleep(backoff); retry()
    else:
        logger.error("dashscope rejected submit: %s", e)
        raise

Prevention

When it happens

Trigger: DashScope responds non-200 to the submit call: invalid/expired API key, insufficient quota or billing, disallowed content flagged by moderation, malformed parameters (bad media URL, unsupported model/params), or service-side rejection.

Common situations: DASHSCOPE_API_KEY revoked or from wrong workspace; model name deprecated or region-restricted; media URLs unreachable by DashScope (private URLs without public access); free-tier quota exhausted; prompt triggering content filter.

Related errors


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