ATH-MaaS/Pixelle-Video · error · RuntimeError

API VLM analysis requires an explicitly selected VLM model.

Error message

API VLM analysis requires an explicitly selected VLM model. Please choose one in the asset analysis service settings.

What it means

_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.

Source

Thrown at pixelle_video/services/api_asset_analysis.py:145

        resolved_type = asset_type or self._get_asset_type(path)
        if resolved_type == "image":
            return await self.analyze_image(asset_path, **kwargs)
        if resolved_type == "video":
            return await self.analyze_video(asset_path, **kwargs)
        raise ValueError(f"Unsupported asset type for VLM analysis: {asset_path}")

    async def _query_vlm(
        self,
        prompt: str,
        image_paths: list[str],
        model: Optional[str],
        video_paths: Optional[list[str]] = None,
    ) -> str:
        from pixelle_video.services.api_services.vlm_client import VLM

        selected_model = (model or "").strip()
        if not selected_model:
            raise RuntimeError(
                "API VLM analysis requires an explicitly selected VLM model. "
                "Please choose one in the asset analysis service settings."
            )

        logger.info(
            f"Analyzing asset via API VLM model={selected_model}, "
            f"images={len(image_paths)}, videos={len(video_paths or [])}"
        )

        providers = self.config.get("api_providers", {}) or {}
        dashscope = providers.get("dashscope", {}) or {}

        client = VLM(
            dashscope_api_key=dashscope.get("api_key"),
            dashscope_base_url=dashscope.get("base_url"),
        )
        result = await asyncio.to_thread(
            client.query,

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Pass model='<vlm-model-name>' to analyze_image/analyze_video
  2. Select a VLM model in the asset analysis service settings so it propagates down
  3. Check your config for the model key and set it explicitly
  4. Ensure no code path strips/overrides the model to an empty string

Example fix

# before
await analyzer.analyze_image("/tmp/cat.jpg")  # no model
# after
await analyzer.analyze_image("/tmp/cat.jpg", model="qwen-vl-max")
Defensive patterns

Strategy: validation

Validate before calling

model = (selected_model or "").strip()
if not model:
    raise RuntimeError("select a VLM model before running API asset analysis")

Type guard

def has_vlm_model(model: object) -> bool:
    return isinstance(model, str) and bool(model.strip())

Try / catch

try:
    desc = await analyzer.analyze_image(path, model=model)
except RuntimeError as e:
    if "requires an explicitly selected VLM model" in str(e):
        model = await prompt_user_for_model_selection()
        desc = await analyzer.analyze_image(path, model=model)
    else:
        raise

Prevention

When it happens

Trigger: Calling analyze_image/analyze_video without model=, or with model=None/""/" ", when the analysis service is configured for API-based VLM inference.

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

Related errors


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