{"record":{"id":"3e5c81c4d1745861","repo":"ATH-MaaS/Pixelle-Video","slug":"dashscope-qwenvlclient-error-e","errorCode":null,"errorMessage":"DashScope QwenVLClient error: {e}","messagePattern":"DashScope QwenVLClient error: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_services/vlm_dashscope.py","lineNumber":80,"sourceCode":"            ]\n            messages = [{\"role\": \"user\", \"content\": content}]\n            response = MultiModalConversation.call(\n                model=model,\n                messages=messages,\n                api_key=self.api_key,\n                enable_thinking=False,\n                **(parameters or {})\n            )\n            if hasattr(response, 'status_code') and response.status_code == 200:\n                # qwen3.5-plus 的返回格式为 { choices: [ { message: { content: [...] } } ] }\n                resp = response.output.choices[0].message.content[0]\n                if resp.get('text'):\n                    return resp['text']\n                return resp\n            else:\n                raise RuntimeError(f\"DashScope QwenVLClient failed: {getattr(response, 'message', response)}\")\n        except Exception as e:\n            raise RuntimeError(f\"DashScope QwenVLClient error: {e}\")\n\n\nif __name__ == \"__main__\":\n    import sys\n    import time\n    import json\n    sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n    from config import Config\n\n    # 支持的 VLM 模型列表\n    MODELS = [\"qwen3.6-plus\", \"qwen3.6-flash\", \"kimi-k2.6\"]\n\n    print(\"=== Qwen VL (DashScope) 多模态可用性测试 ===\")\n    api_key = getattr(Config, \"DASHSCOPE_API_KEY\", None) or os.getenv(\"DASHSCOPE_API_KEY\", \"\")\n    if not api_key:\n        print(\"✗ DASHSCOPE_API_KEY 未设置，跳过\")\n        sys.exit(1)\n    print(f\"  API Key: {api_key[:6]}***{api_key[-4:]}\")","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_services/vlm_dashscope.py#L62-L98","documentation":"chat() wraps the entire DashScope call — request construction, MultiModalConversation.call(), and response parsing — in a try/except that re-raises any exception as RuntimeError('DashScope QwenVLClient error: {e}'). Any underlying failure (network error, SDK exception, KeyError/AttributeError while parsing the response, or even the 'failed' RuntimeError from the status-code branch) gets wrapped by this message.","triggerScenarios":"Any exception inside the try block of chat(): network timeouts/connection errors to DashScope, dashscope SDK exceptions, or parsing errors like response.output.choices being empty/None so that choices[0].message.content[0] raises. Also wraps error 101's RuntimeError, so messages may be nested ('DashScope QwenVLClient error: DashScope QwenVLClient failed: ...').","commonSituations":"Offline or firewalled environments; very large images causing timeouts; API returning an unexpected schema after a dashscope SDK upgrade (parsing AttributeError/KeyError); empty choices array on content-filter rejection; nested wrapping making the root cause harder to read.","solutions":["Read the inner exception text after 'DashScope QwenVLClient error:' to identify the root cause (network, SDK, or parsing).","For network errors, check connectivity to dashscope endpoints and add retry with backoff.","If parsing fails, print/log the full `response` object to inspect the actual schema, and verify your dashscope SDK version matches the expected response format.","Note that a nested 'DashScope QwenVLClient failed:' inside the message means the API returned a non-200 status; fix the API-level issue first (key, model, inputs)."],"exampleFix":"# before\ntry:\n    resp = response.output.choices[0].message.content[0]\nexcept Exception as e:\n    raise RuntimeError(f\"DashScope QwenVLClient error: {e}\")  # may hide empty choices\n# after\ntry:\n    resp = response.output.choices[0].message.content[0]\nexcept (IndexError, AttributeError, KeyError, TypeError) as e:\n    raise RuntimeError(f\"DashScope QwenVLClient error: {e}; raw response: {response}\")","handlingStrategy":"try-catch","validationCode":"import os\nassert os.getenv(\"DASHSCOPE_API_KEY\"), \"missing API key\"\nassert all(os.path.exists(p) or p.startswith(\"http\") for p in images), \"invalid image path\"","typeGuard":null,"tryCatchPattern":"try:\n    result = client.chat(text=text, images=images, model=model)\nexcept RuntimeError as e:\n    inner = str(e)\n    if \"DashScope QwenVLClient failed:\" in inner:\n        ...  # API-level non-200: fix key/model/inputs\n    elif isinstance(e.__cause__, (ConnectionError, TimeoutError)) or \"timeout\" in inner.lower():\n        ...  # network: retry with backoff\n    else:\n        ...  # parsing/SDK issue: log raw response and check dashscope version","preventionTips":["Always catch RuntimeError around chat() and log the full nested message plus e.__cause__.","Keep the dashscope SDK version pinned so response parsing matches the schema.","Add timeout and retry-with-backoff for network resilience.","Log the raw response object when parsing fails to diagnose schema changes."],"tags":["dashscope","exception-wrapping","qwen","vlm","network"],"backgroundTag":"api-request-failed","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}