ATH-MaaS/Pixelle-Video · error · RuntimeError

DashScope QwenVLClient failed

Error message

DashScope QwenVLClient failed: {getattr(response, 'message', response)}

What it means

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.

Solutions

  1. Read the embedded response.message in the error text to get DashScope's specific error code (e.g. InvalidApiKey, Throttling, InvalidParameter).
  2. Verify DASHSCOPE_API_KEY is set and valid for the account/region.
  3. Confirm the model name passed to chat() is valid and enabled (e.g. 'qwen3.5-plus', 'qwen3-vl-plus').
  4. Check that all image/video paths exist locally or are reachable URLs.
  5. Add retry/backoff if the message indicates throttling or transient server errors.

Example fix

# before
result = client.chat(text, images=['missing.png'], model='qwen3.5-plus')
RuntimeError: DashScope QwenVLClient failed: InvalidParameter: file not found
# after
img = 'missing.png'
assert os.path.exists(img), f'image not found: {img}'
result = client.chat(text, images=[img], model='qwen3.5-plus')
Defensive patterns

Strategy: try-catch

Validate before calling

import os
assert os.getenv("DASHSCOPE_API_KEY"), "DASHSCOPE_API_KEY not set"
for p in images:
    assert p.startswith(("http://", "https://")) or os.path.exists(p), f"bad image path: {p}"

Type guard

def is_ok_response(response) -> bool:
    return (
        hasattr(response, "status_code")
        and response.status_code == 200
        and getattr(getattr(response, "output", None), "choices", None)
    )

Try / catch

try:
    result = client.chat(text=text, images=images, model=model)
except RuntimeError as e:
    msg = str(e)
    if "failed:" in msg:          # non-200 status from DashScope
        logger.error(f"DashScope API rejected request: {msg}")  # inspect code in msg
    # handle: fix key/model/inputs, or fall back to another provider

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30). Data as JSON: /api/errors/07b3ebec4d7a3231. Report an issue: GitHub.

Appendix: source

Thrown at pixelle_video/services/api_services/vlm_dashscope.py:78

                *({"image": p} for p in images),
                *({"video": p} for p in videos or []),
            ]
            messages = [{"role": "user", "content": content}]
            response = MultiModalConversation.call(
                model=model,
                messages=messages,
                api_key=self.api_key,
                enable_thinking=False,
                **(parameters or {})
            )
            if hasattr(response, 'status_code') and response.status_code == 200:
                # qwen3.5-plus 的返回格式为 { choices: [ { message: { content: [...] } } ] }
                resp = response.output.choices[0].message.content[0]
                if resp.get('text'):
                    return resp['text']
                return resp
            else:
                raise RuntimeError(f"DashScope QwenVLClient failed: {getattr(response, 'message', response)}")
        except Exception as e:
            raise RuntimeError(f"DashScope QwenVLClient error: {e}")


if __name__ == "__main__":
    import sys
    import time
    import json
    sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
    from config import Config

    # 支持的 VLM 模型列表
    MODELS = ["qwen3.6-plus", "qwen3.6-flash", "kimi-k2.6"]

    print("=== Qwen VL (DashScope) 多模态可用性测试 ===")
    api_key = getattr(Config, "DASHSCOPE_API_KEY", None) or os.getenv("DASHSCOPE_API_KEY", "")
    if not api_key:
        print("✗ DASHSCOPE_API_KEY 未设置,跳过")

View on GitHub (pinned to 848b054e4f)