{"record":{"id":"5c88d20d9b9c46e1","repo":"ATH-MaaS/Pixelle-Video","slug":"dashscope-vlm-model-must-be-explicitly-selected","errorCode":null,"errorMessage":"DashScope VLM model must be explicitly selected.","messagePattern":"DashScope VLM model must be explicitly selected\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_services/vlm_client.py","lineNumber":36,"sourceCode":"        dashscope_key = dashscope_api_key or Config.DASHSCOPE_API_KEY\n\n        self.dashscope_client = (\n            QwenVLClient(\n                api_key=dashscope_key,\n                base_url=dashscope_base_url or Config.DASHSCOPE_BASE_URL\n            )\n            if dashscope_key else None\n        )\n\n    def query(self,\n             prompt: str,\n             image_paths: Optional[List[str]] = None,\n             model: Optional[str] = None,\n             session_id: Optional[str] = None,\n             video_paths: Optional[List[str]] = None) -> str:\n        selected_model = (model or \"\").strip()\n        if not selected_model:\n            raise RuntimeError(\"DashScope VLM model must be explicitly selected.\")\n\n        if Config.PRINT_MODEL_INPUT:\n            print(\"---- VLM REQUEST ----\")\n            print(f\"Prompt: {prompt}\")\n            if image_paths:\n                print(f\"Images: {len(image_paths)}\")\n                for p in image_paths:\n                    if p.startswith(\"data:\"):\n                        print(f\" - [Base64图片]\")\n                    else:\n                        print(f\" - {p}\")\n            if video_paths:\n                print(f\"Videos: {len(video_paths)}\")\n                for p in video_paths:\n                    print(f\" - {p}\")\n            print(f\"Model: {selected_model}\")\n            if session_id:\n                print(f\"Session ID: {session_id}\")","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_services/vlm_client.py#L18-L54","documentation":"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.","triggerScenarios":"Calling vlm_client.query(prompt, image_paths=[...]) without model=, or with model=\"\" / model=\"   \".","commonSituations":"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.","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"],"exampleFix":"// before\nvlm.query(prompt=prompt, image_paths=[img])\n// after\nvlm.query(prompt=prompt, image_paths=[img], model=\"qwen-vl-max\")","handlingStrategy":"validation","validationCode":"def ensure_model(model: str | None) -> str:\n    m = (model or \"\").strip()\n    if not m:\n        raise ValueError(\"DashScope VLM model must be configured (e.g. 'qwen-vl-max')\")\n    return m","typeGuard":"def has_model(model: str | None) -> bool:\n    return isinstance(model, str) and bool(model.strip())","tryCatchPattern":"try:\n    answer = vlm.query(prompt=p, image_paths=[img], model=cfg.vlm_model)\nexcept RuntimeError as e:\n    if \"must be explicitly selected\" in str(e):\n        logging.critical(\"VLM model not configured; set it in config\")\n    else:\n        raise","preventionTips":["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"],"tags":["dashscope","vlm","required-argument","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}