{"record":{"id":"20f8e109af20de83","repo":"ATH-MaaS/Pixelle-Video","slug":"api-video-url-task-id-status-r","errorCode":null,"errorMessage":"万象视频 API 未返回 video_url 或 task_id，无法查询结果: status={rsp.status_code}, code={rsp.code}, message={rsp.message}, task_status={task_status}","messagePattern":"万象视频 API 未返回 video_url 或 task_id，无法查询结果: status=(.+?), code=(.+?), message=(.+?), task_status=(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_services/video_dashscope.py","lineNumber":369,"sourceCode":"                call_kwargs[\"seed\"] = seed\n\n            rsp = self._with_network_retry(\n                \"submit task\",\n                lambda: VideoSynthesis.call(**call_kwargs),\n            )\n\n        if rsp.status_code != HTTPStatus.OK:\n            raise RuntimeError(\n                f\"万象视频 API 错误: status={rsp.status_code}, \"\n                f\"code={rsp.code}, message={rsp.message}\"\n            )\n\n        video_url = self._extract_video_url(rsp)\n        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","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_services/video_dashscope.py#L351-L387","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Log the raw rsp output dict to see its actual schema.","Upgrade/downgrade the dashscope SDK to match the response format the client extracts from.","Inspect rsp.code/message embedded in the exception — a business error may hide behind HTTP 200.","Check whether the model returns async-only results and that task extraction keys (output.task_id) match the SDK response.","Bypass proxies/gateways that may rewrite the response body."],"exampleFix":"// before\nvideo = client.generate_video(...)  # RuntimeError: no video_url/task_id\n// after\ntry:\n    video = client.generate_video(...)\nexcept RuntimeError as e:\n    import dashscope\n    print(\"sdk version:\", dashscope.__version__)  # align with client expectations\n    logger.debug(\"raw response: %s\", e)\n    raise","handlingStrategy":"try-catch","validationCode":"import dashscope\nassert dashscope.__version__ == PINNED_VERSION, \"dashscope SDK version drift\"\n# submit responses must carry video_url or task_id; verify on a smoke call","typeGuard":"def response_has_result(rsp) -> bool:\n    out = getattr(getattr(rsp, \"output\", None), \"__dict__\", {}) or {}\n    return bool(out.get(\"video_url\") or out.get(\"task_id\"))","tryCatchPattern":"try:\n    video = client.generate_video(...)\nexcept RuntimeError as e:\n    logger.error(\"unusable dashscope response: %s\", e)  # includes status/code/message/task_status\n    raise","preventionTips":["Pin the dashscope SDK version; response schemas change between releases.","Log the raw submit response output once per model to verify extraction keys.","Compare submit vs wait behavior per model (sync vs async).","Test with a smoke generation after any SDK or model upgrade."],"tags":["dashscope","response-parsing","async-task","sdk-version"],"backgroundTag":"unexpected-response-shape","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}