{"record":{"id":"c1c198634e65750a","repo":"ATH-MaaS/Pixelle-Video","slug":"status-rsp-status-code-code-rsp-co","errorCode":null,"errorMessage":"万象视频任务查询失败: status={rsp.status_code}, code={rsp.code}, message={rsp.message}, task_id={task_id}","messagePattern":"万象视频任务查询失败: status=(.+?), code=(.+?), message=(.+?), task_id=(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_services/video_dashscope.py","lineNumber":383,"sourceCode":"        if not video_url:\n            task_id = self._extract_task_id(rsp)\n            task_status = self._extract_task_status(rsp)\n            if not task_id:\n                raise RuntimeError(\n                    \"万象视频 API 未返回 video_url 或 task_id，无法查询结果: \"\n                    f\"status={rsp.status_code}, code={rsp.code}, message={rsp.message}, \"\n                    f\"task_status={task_status}\"\n                )\n\n            logger.info(f\"DashscopeVideoClient: 任务已提交 task_id={task_id}, status={task_status}; 等待生成完成...\")\n            rsp = self._with_network_retry(\n                f\"wait task {task_id}\",\n                lambda: VideoSynthesis.wait(task=rsp, api_key=self.api_key),\n                max_attempts=8,\n                base_delay=5.0,\n            )\n            if rsp.status_code != HTTPStatus.OK:\n                raise RuntimeError(\n                    f\"万象视频任务查询失败: status={rsp.status_code}, \"\n                    f\"code={rsp.code}, message={rsp.message}, task_id={task_id}\"\n                )\n\n            video_url = self._extract_video_url(rsp)\n            task_status = self._extract_task_status(rsp)\n            if not video_url:\n                raise RuntimeError(\n                    \"万象视频任务完成后仍未返回 video_url: \"\n                    f\"code={rsp.code}, message={rsp.message}, task_id={task_id}, task_status={task_status}, \"\n                    f\"output={self._safe_output_repr(rsp)}\"\n                )\n\n        logger.info(f\"DashscopeVideoClient: 视频生成成功: {video_url}\")\n\n        # 确保输出目录存在\n        os.makedirs(os.path.dirname(save_path), exist_ok=True)\n","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_services/video_dashscope.py#L365-L401","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nvideo = client.generate_video(...)  # RuntimeError on wait\n// after\ntry:\n    video = client.generate_video(...)\nexcept RuntimeError as e:\n    task_id = extract_task_id_from(str(e))  # from error text\n    logger.error(\"task %s failed, check dashscope console\", task_id)\n    raise","handlingStrategy":"retry","validationCode":"# before submitting long tasks, confirm API key and quota are healthy\nif not os.environ.get(\"DASHSCOPE_API_KEY\"):\n    raise ValueError(\"DASHSCOPE_API_KEY not set\")","typeGuard":"def wait_rsp_ok(rsp) -> bool:\n    return getattr(rsp, \"status_code\", None) == 200","tryCatchPattern":"try:\n    video = client.generate_video(...)\nexcept RuntimeError as e:\n    # extract task_id from message and query console/API for final status\n    logger.error(\"dashscope task wait failed: %s\", e)\n    raise","preventionTips":["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."],"tags":["dashscope","async-task","polling","api-error"],"backgroundTag":"api-error-response","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}