roboflow/supervision · error · ValueError

Invalid VLM result type

Error message

Invalid VLM result type: {type(result)}. Must be {RESULT_TYPES[vlm]}

What it means

Error "Invalid VLM result type: {type(result)}. Must be {RESULT_TYPES[vlm]}" thrown in roboflow/supervision.

Solutions

  1. Return the result from the model in the type expected for the chosen VLM (see the error message for the expected type).
  2. If the model returns a different structure, extract the expected payload (string or dict) before calling the connector.

When it happens

Trigger: Thrown at src/supervision/detection/vlm.py:195 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/93250b50a2c2873c. Report an issue: GitHub.

Appendix: source

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

        result: The result object to validate (type depends on VLM).
        kwargs: Dictionary of arguments to validate against required/allowed lists.

    Returns:
        The validated VLM enum value.

    Raises:
        ValueError: If the VLM, result type, or arguments are invalid.
    """
    if isinstance(vlm, str):
        try:
            vlm = VLM(vlm.lower())
        except ValueError:
            raise ValueError(
                f"Invalid vlm value: {vlm}. Must be one of {[e.value for e in VLM]}"
            )

    if not isinstance(result, RESULT_TYPES[vlm]):
        raise ValueError(
            f"Invalid VLM result type: {type(result)}. Must be {RESULT_TYPES[vlm]}"
        )

    required_args = REQUIRED_ARGUMENTS.get(vlm, [])
    for arg in required_args:
        if arg not in kwargs:
            raise ValueError(f"Missing required argument: {arg}")

    allowed_args = ALLOWED_ARGUMENTS.get(vlm, [])
    for arg in kwargs:
        if arg not in allowed_args:
            raise ValueError(f"Argument {arg} is not allowed for {vlm.name}")

    return vlm


@deprecated(  # type: ignore[untyped-decorator]
    target=_validate_vlm_parameters,

View on GitHub (pinned to 7f254d9784)