ATH-MaaS/Pixelle-Video · error · RuntimeError

Seedance 视频生成{status}: {error_msg}

Error message

Seedance 视频生成{status}: {error_msg}

What it means

_poll_until_done raises RuntimeError when the task status becomes 'failed' or 'expired', including the API-provided error message (error.message, status_msg, or '未知错误'). This is the remote generation failing server-side, not a client bug.

Source

Thrown at pixelle_video/services/api_services/video_seedance.py:162

    def _poll_until_done(self, task_id: str, max_polls: int = 120, interval: int = 5) -> str:
        # 同步更新查询接口路径
        url = f"{self.base_url}/contents/generations/tasks/{task_id}"
        
        for i in range(max_polls):
            resp = requests.get(url, headers=self._headers(), timeout=30, proxies=self._proxies())
            resp.raise_for_status()
            data = resp.json()
            
            status = data.get("status")
            if status == "succeeded":
                # 根据实际返回体,URL 位于 content.video_url 或 video_url
                video_url = data.get("content", {}).get("video_url") or data.get("video_url")
                if not video_url:
                    raise RuntimeError(f"Seedance 任务成功但未返回视频 URL: {data}")
                return video_url
            elif status in ("failed", "expired"):
                error_msg = data.get("error", {}).get("message") or data.get("status_msg") or "未知错误"
                raise RuntimeError(f"Seedance 视频生成{status}: {error_msg}")
            
            logger.debug(f"SeedanceVideoClient: 任务进行中 {task_id}, status={status}, poll={i+1}")
            time.sleep(interval)
            
        raise TimeoutError(f"Seedance 视频生成超时 (task_id={task_id})")

    def _download_video(self, url: str, save_path: str):
        os.makedirs(os.path.dirname(save_path), exist_ok=True)
        resp = requests.get(url, stream=True, timeout=120, proxies=self._proxies())
        resp.raise_for_status()
        with open(save_path, "wb") as f:
            for chunk in resp.iter_content(chunk_size=8192):
                if chunk:
                    f.write(chunk)
        logger.info(f"SeedanceVideoClient: 视频已保存: {save_path}")

if __name__ == "__main__":
    import sys

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Read the embedded error_msg from the exception to identify the server-side cause
  2. If 'expired', retry generation — long queues can outlive the task TTL; consider increasing max_polls/interval
  3. If content-policy failure, revise the prompt or replace the input image
  4. Check quota/billing and model availability in the Volcano Engine console
Defensive patterns

Strategy: retry

Try / catch

import time
for attempt in range(3):
    try:
        video = client.generate_video(prompt=p, image_path=img, save_path=out)
        break
    except RuntimeError as e:
        if "生成failed" in str(e) or "生成expired" in str(e):
            logging.warning(f"Seedance task failed/expired (attempt {attempt+1}): {e}")
            time.sleep(30)
        else:
            raise

Prevention

When it happens

Trigger: Poll response has status=='failed' or 'expired' — e.g. content-policy rejection of prompt/image, unsupported image format, model capacity errors, or task TTL exceeded before completion.

Common situations: Prompt violates content moderation; input image too large/wrong mime; model overloaded and task expired (120 polls × 5s = 10 min cap may be exceeded server-side); insufficient account quota for the chosen model/duration.

Related errors


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