ATH-MaaS/Pixelle-Video · error · RuntimeError

DashScope QwenVLClient error: {e}

Error message

DashScope QwenVLClient error: {e}

What it means

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.

Source

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

            ]
            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 未设置,跳过")
        sys.exit(1)
    print(f"  API Key: {api_key[:6]}***{api_key[-4:]}")

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Read the inner exception text after 'DashScope QwenVLClient error:' to identify the root cause (network, SDK, or parsing).
  2. For network errors, check connectivity to dashscope endpoints and add retry with backoff.
  3. 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.
  4. 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).

Example fix

# before
try:
    resp = response.output.choices[0].message.content[0]
except Exception as e:
    raise RuntimeError(f"DashScope QwenVLClient error: {e}")  # may hide empty choices
# after
try:
    resp = response.output.choices[0].message.content[0]
except (IndexError, AttributeError, KeyError, TypeError) as e:
    raise RuntimeError(f"DashScope QwenVLClient error: {e}; raw response: {response}")
Defensive patterns

Strategy: try-catch

Validate before calling

import os
assert os.getenv("DASHSCOPE_API_KEY"), "missing API key"
assert all(os.path.exists(p) or p.startswith("http") for p in images), "invalid image path"

Try / catch

try:
    result = client.chat(text=text, images=images, model=model)
except RuntimeError as e:
    inner = str(e)
    if "DashScope QwenVLClient failed:" in inner:
        ...  # API-level non-200: fix key/model/inputs
    elif isinstance(e.__cause__, (ConnectionError, TimeoutError)) or "timeout" in inner.lower():
        ...  # network: retry with backoff
    else:
        ...  # parsing/SDK issue: log raw response and check dashscope version

Prevention

When it happens

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

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

Related errors


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