{"record":{"id":"47b3d3a5cc763a30","repo":"ATH-MaaS/Pixelle-Video","slug":"api-vlm-analysis-requires-an-explicitly-selected-v","errorCode":null,"errorMessage":"API VLM analysis requires an explicitly selected VLM model. Please choose one in the asset analysis service settings.","messagePattern":"API VLM analysis requires an explicitly selected VLM model\\. Please choose one in the asset analysis service settings\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_asset_analysis.py","lineNumber":145,"sourceCode":"        resolved_type = asset_type or self._get_asset_type(path)\n        if resolved_type == \"image\":\n            return await self.analyze_image(asset_path, **kwargs)\n        if resolved_type == \"video\":\n            return await self.analyze_video(asset_path, **kwargs)\n        raise ValueError(f\"Unsupported asset type for VLM analysis: {asset_path}\")\n\n    async def _query_vlm(\n        self,\n        prompt: str,\n        image_paths: list[str],\n        model: Optional[str],\n        video_paths: Optional[list[str]] = None,\n    ) -> str:\n        from pixelle_video.services.api_services.vlm_client import VLM\n\n        selected_model = (model or \"\").strip()\n        if not selected_model:\n            raise RuntimeError(\n                \"API VLM analysis requires an explicitly selected VLM model. \"\n                \"Please choose one in the asset analysis service settings.\"\n            )\n\n        logger.info(\n            f\"Analyzing asset via API VLM model={selected_model}, \"\n            f\"images={len(image_paths)}, videos={len(video_paths or [])}\"\n        )\n\n        providers = self.config.get(\"api_providers\", {}) or {}\n        dashscope = providers.get(\"dashscope\", {}) or {}\n\n        client = VLM(\n            dashscope_api_key=dashscope.get(\"api_key\"),\n            dashscope_base_url=dashscope.get(\"base_url\"),\n        )\n        result = await asyncio.to_thread(\n            client.query,","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_asset_analysis.py#L127-L163","documentation":"_query_vlm requires an explicit VLM model name because it calls an external API rather than a local model; it raises RuntimeError when the model argument is empty or whitespace-only.","triggerScenarios":"Calling analyze_image/analyze_video without model=, or with model=None/\"\"/\"  \", when the analysis service is configured for API-based VLM inference.","commonSituations":"Model not selected in the asset-analysis service settings UI; config default lost after upgrade; caller assumed a default model exists but API mode demands an explicit choice.","solutions":["Pass model='<vlm-model-name>' to analyze_image/analyze_video","Select a VLM model in the asset analysis service settings so it propagates down","Check your config for the model key and set it explicitly","Ensure no code path strips/overrides the model to an empty string"],"exampleFix":"# before\nawait analyzer.analyze_image(\"/tmp/cat.jpg\")  # no model\n# after\nawait analyzer.analyze_image(\"/tmp/cat.jpg\", model=\"qwen-vl-max\")","handlingStrategy":"validation","validationCode":"model = (selected_model or \"\").strip()\nif not model:\n    raise RuntimeError(\"select a VLM model before running API asset analysis\")","typeGuard":"def has_vlm_model(model: object) -> bool:\n    return isinstance(model, str) and bool(model.strip())","tryCatchPattern":"try:\n    desc = await analyzer.analyze_image(path, model=model)\nexcept RuntimeError as e:\n    if \"requires an explicitly selected VLM model\" in str(e):\n        model = await prompt_user_for_model_selection()\n        desc = await analyzer.analyze_image(path, model=model)\n    else:\n        raise","preventionTips":["Set a default VLM model in service settings and read it before analysis","Surface model selection as a required UI field in API mode","Fail fast at config load if the model key is empty for API-based analysis"],"tags":["configuration","missing-config","vlm"],"backgroundTag":"missing-config-value","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}