ATH-MaaS/Pixelle-Video · error · RuntimeError
DashScope VLM model must be explicitly selected.
Error message
DashScope VLM model must be explicitly selected.
What it means
VlmClient.query requires an explicit DashScope VLM model name; it raises RuntimeError when the model argument is missing, None, or an empty/whitespace string. The client deliberately does not guess a default model.
Source
Thrown at pixelle_video/services/api_services/vlm_client.py:36
dashscope_key = dashscope_api_key or Config.DASHSCOPE_API_KEY
self.dashscope_client = (
QwenVLClient(
api_key=dashscope_key,
base_url=dashscope_base_url or Config.DASHSCOPE_BASE_URL
)
if dashscope_key else None
)
def query(self,
prompt: str,
image_paths: Optional[List[str]] = None,
model: Optional[str] = None,
session_id: Optional[str] = None,
video_paths: Optional[List[str]] = None) -> str:
selected_model = (model or "").strip()
if not selected_model:
raise RuntimeError("DashScope VLM model must be explicitly selected.")
if Config.PRINT_MODEL_INPUT:
print("---- VLM REQUEST ----")
print(f"Prompt: {prompt}")
if image_paths:
print(f"Images: {len(image_paths)}")
for p in image_paths:
if p.startswith("data:"):
print(f" - [Base64图片]")
else:
print(f" - {p}")
if video_paths:
print(f"Videos: {len(video_paths)}")
for p in video_paths:
print(f" - {p}")
print(f"Model: {selected_model}")
if session_id:
print(f"Session ID: {session_id}")View on GitHub (pinned to 848b054e4f)
Solutions
- Pass an explicit model, e.g. query(prompt, model="qwen-vl-max")
- Ensure your config/settings object actually has a non-empty model value before calling
- If a caller passes Optional model, validate/coalesce it at that layer before invoking query
Example fix
// before vlm.query(prompt=prompt, image_paths=[img]) // after vlm.query(prompt=prompt, image_paths=[img], model="qwen-vl-max")
Defensive patterns
Strategy: validation
Validate before calling
def ensure_model(model: str | None) -> str:
m = (model or "").strip()
if not m:
raise ValueError("DashScope VLM model must be configured (e.g. 'qwen-vl-max')")
return m Type guard
def has_model(model: str | None) -> bool:
return isinstance(model, str) and bool(model.strip()) Try / catch
try:
answer = vlm.query(prompt=p, image_paths=[img], model=cfg.vlm_model)
except RuntimeError as e:
if "must be explicitly selected" in str(e):
logging.critical("VLM model not configured; set it in config")
else:
raise Prevention
- Load the model name from config and assert it is non-empty at startup
- Never forward an Optional model straight into query(); coalesce or validate first
- List allowed VLM models and validate against them
When it happens
Trigger: Calling vlm_client.query(prompt, image_paths=[...]) without model=, or with model="" / model=" ".
Common situations: Caller that used to pass a default model refactored to Optional and stopped supplying it; config value for model name empty in settings; upstream code forwards its own None model parameter.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- API VLM analysis requires an explicitly selected VLM model.
- DASHSCOPE_API_KEY 未设置,无法使用图片上传服务
- DashScope video input does not support data URLs in this ada
- 无法解析 base64 图片: {e}
- DashScope QwenVLClient failed: {getattr(response, 'message',
AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30).
Data as JSON: /api/errors/5c88d20d9b9c46e1.
Report an issue: GitHub.