{"record":{"id":"07b3ebec4d7a3231","repo":"ATH-MaaS/Pixelle-Video","slug":"dashscope-qwenvlclient-failed-getattr-response","errorCode":null,"errorMessage":"DashScope QwenVLClient failed: {getattr(response, 'message', response)}","messagePattern":"DashScope QwenVLClient failed: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_services/vlm_dashscope.py","lineNumber":78,"sourceCode":"                *({\"image\": p} for p in images),\n                *({\"video\": p} for p in videos or []),\n            ]\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 未设置，跳过\")","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_services/vlm_dashscope.py#L60-L96","documentation":"chat() calls MultiModalConversation.call() and checks response.status_code == 200. When the DashScope API returns a non-200 status (the response object carries an error message instead of output.choices), the client raises RuntimeError('DashScope QwenVLClient failed: ...') embedding response.message or the raw response. This is an API-level failure reported by the DashScope service, re-raised as a Python RuntimeError.","triggerScenarios":"Any call where the DashScope multimodal endpoint returns status_code != 200: invalid/absent DASHSCOPE_API_KEY, unknown model name (e.g. misspelled qwen model), malformed image/video path or URL, payload rejected by the API, throttling/quota errors, or service-side errors surfaced in response.message.","commonSituations":"Expired or wrong API key; using a model id not enabled for the account; passing a local image path that doesn't exist (can't be converted to file://); region/account without access to qwen3.5-plus or qwen3-vl-plus; rate limits during batch processing.","solutions":["Read the embedded response.message in the error text to get DashScope's specific error code (e.g. InvalidApiKey, Throttling, InvalidParameter).","Verify DASHSCOPE_API_KEY is set and valid for the account/region.","Confirm the model name passed to chat() is valid and enabled (e.g. 'qwen3.5-plus', 'qwen3-vl-plus').","Check that all image/video paths exist locally or are reachable URLs.","Add retry/backoff if the message indicates throttling or transient server errors."],"exampleFix":"# before\nresult = client.chat(text, images=['missing.png'], model='qwen3.5-plus')\nRuntimeError: DashScope QwenVLClient failed: InvalidParameter: file not found\n# after\nimg = 'missing.png'\nassert os.path.exists(img), f'image not found: {img}'\nresult = client.chat(text, images=[img], model='qwen3.5-plus')","handlingStrategy":"try-catch","validationCode":"import os\nassert os.getenv(\"DASHSCOPE_API_KEY\"), \"DASHSCOPE_API_KEY not set\"\nfor p in images:\n    assert p.startswith((\"http://\", \"https://\")) or os.path.exists(p), f\"bad image path: {p}\"","typeGuard":"def is_ok_response(response) -> bool:\n    return (\n        hasattr(response, \"status_code\")\n        and response.status_code == 200\n        and getattr(getattr(response, \"output\", None), \"choices\", None)\n    )","tryCatchPattern":"try:\n    result = client.chat(text=text, images=images, model=model)\nexcept RuntimeError as e:\n    msg = str(e)\n    if \"failed:\" in msg:          # non-200 status from DashScope\n        logger.error(f\"DashScope API rejected request: {msg}\")  # inspect code in msg\n    # handle: fix key/model/inputs, or fall back to another provider","preventionTips":["Validate DASHSCOPE_API_KEY at startup before making calls.","Whitelist/verify model names before passing them to chat().","Check that every image/video path exists (or is a reachable URL) before the call.","Handle throttling with exponential backoff for batch workloads."],"tags":["dashscope","api-error","qwen","vlm","http-status"],"backgroundTag":"api-request-failed","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}