roboflow/supervision · error · ValueError

Invalid value type: {type(value)}. Must be an instance of {c

Error message

Invalid value type: {type(value)}. Must be an instance of {cls.__name__} or str.

What it means

Error "Invalid value type: {type(value)}. Must be an instance of {cls.__name__} or str." thrown in roboflow/supervision.

Source

Thrown at src/supervision/detection/vlm.py:68

    @classmethod
    def list(cls) -> list[str]:
        return [c.value for c in cls]

    @classmethod
    def from_value(cls, value: LMM | str) -> LMM:
        warn_deprecated(
            "`LMM` is deprecated since `supervision-0.27.0` and will be removed in "
            "`supervision-0.31.0`. Use `VLM` instead."
        )
        if isinstance(value, cls):
            return value
        if isinstance(value, str):
            value = value.lower()
            try:
                return cls(value)
            except ValueError:
                raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}")
        raise ValueError(
            f"Invalid value type: {type(value)}. Must be an instance of "
            f"{cls.__name__} or str."
        )


class VLM(Enum):
    """
    Enum specifying supported Vision-Language Models (VLMs).

    Attributes:
        PALIGEMMA: Google's PaliGemma vision-language model.
        FLORENCE_2: Microsoft's Florence-2 vision-language model.
        QWEN_2_5_VL: Qwen2.5-VL open vision-language model from Alibaba.
        QWEN_3_VL: Qwen3-VL open vision-language model from Alibaba.
        GOOGLE_GEMINI_2_0: Google Gemini 2.0 vision-language model.
        GOOGLE_GEMINI_2_5: Google Gemini 2.5 vision-language model.
        GOOGLE_GEMINI_3_5: Google Gemini 3.5 vision-language model.
        MOONDREAM: The Moondream vision-language model.

View on GitHub (pinned to 7f254d9784)

Solutions

  1. Pass either the enum member (e.g. VLM.PALIGEMMA) or its string value, not another type.
  2. Convert your value with the enum's constructor, e.g. VLM(value) or cls(value), before passing it in.

When it happens

Trigger: Thrown at src/supervision/detection/vlm.py:68 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of roboflow/supervision@7f254d9784 (2026-08-15). Data as JSON: /api/errors/b3f1e380439939c1. Report an issue: GitHub.