ATH-MaaS/Pixelle-Video · error · RuntimeError
万象视频任务完成后仍未返回 video_url: code={rsp.code}, message={rsp.messa
Error message
万象视频任务完成后仍未返回 video_url: code={rsp.code}, message={rsp.message}, task_id={task_id}, task_status={task_status}, output={self._safe_output_repr(rsp)} What it means
DashscopeVideoClient.generate_video polls the DashScope VideoSynthesis task until wait() returns, but the final response still contains no video URL in its output. The client raises RuntimeError instead of returning a None URL, because the task reported completion (or wait() succeeded) yet the output payload lacks the expected video field.
Source
Thrown at pixelle_video/services/api_services/video_dashscope.py:391
)
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)
# 下载视频
resp = self._with_network_retry(
"download video",
lambda: requests.get(
video_url,
stream=True,
timeout=120,
proxies={"http": self.local_proxy, "https": self.local_proxy} if self.local_proxy else None,View on GitHub (pinned to 848b054e4f)
Solutions
- Read task_status and output in the exception message; if status is FAILED/CANCELED, fix the underlying cause reported in rsp.message (often prompt policy violation or quota).
- Verify the DashScope SDK version matches what dashscope VideoSynthesis.wait returns; upgrade or pin dashscope and check _extract_video_url against the actual response shape.
- Log the full _safe_output_repr(rsp) payload and compare against the model's documented output schema; adjust _extract_video_url if DashScope renamed fields.
- Retry generation with a different prompt or seed if the message indicates content moderation or transient internal failure.
Example fix
# before
video_url = self._extract_video_url(rsp)
task_status = self._extract_task_status(rsp)
if not video_url:
raise RuntimeError("万象视频任务完成后仍未返回 video_url: ...")
# after
video_url = self._extract_video_url(rsp)
task_status = self._extract_task_status(rsp)
if not video_url and task_status in ("FAILED", "CANCELED"):
raise RuntimeError(
f"万象视频任务失败: status={task_status}, message={rsp.message}, task_id={task_id}"
)
if not video_url:
raise RuntimeError("万象视频任务完成后仍未返回 video_url: ...") Defensive patterns
Strategy: try-catch
Validate before calling
# 提交前无法预知结果,但可先校验 prompt/配额
if not prompt or not prompt.strip():
raise ValueError("prompt 不能为空")
if len(prompt) > 2000:
raise ValueError("prompt 过长,可能触发内容策略") Type guard
def has_video_url(rsp) -> bool:
return bool(getattr(rsp, 'output', None) and rsp.output.get('video_url')) Try / catch
try:
url = client.generate_video(...)
except RuntimeError as e:
if "video_url" in str(e):
# 解析 task_status;FAILED/CANCELED 时读取 message 修复输入后重试
logger.error(f"DashScope 任务未产出视频: {e}")
else:
raise Prevention
- Pin the dashscope SDK version and verify _extract_video_url against real responses after upgrades
- Keep prompts within content policy to avoid silent task failures
- Monitor DashScope quota so tasks don't fail server-side
- Persist task_id so a failed wait can be investigated via the console
When it happens
Trigger: Calling generate_video on wan2.x models where the asynchronous task finishes with task_status not 'succeeded' (e.g. FAILED/CANCELED/UNKNOWN) or succeeds with an output structure missing video_url, so _extract_video_url(rsp) returns falsy after the VideoSynthesis.wait poll (video_dashscope.py:388-395).
Common situations: Content-policy rejection of the prompt/image by DashScope, exhausted API quota so the task silently fails, DashScope SDK version drift changing the response output schema so _extract_video_url can no longer find the URL field, or the task ending in a non-success state the poller doesn't detect.
Related errors
- Image edit failed: {response.code}, {response.message}, stat
- 万象视频 API 未返回 video_url 或 task_id,无法查询结果: status={rsp.status_
- 万象视频任务查询失败: status={rsp.status_code}, code={rsp.code}, messa
- DASHSCOPE_API_KEY 未设置,无法使用图片上传服务
- Failed to get upload policy: {response.text}
AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30).
Data as JSON: /api/errors/34b5dc4901e7495e.
Report an issue: GitHub.