roboflow/supervision · error · ValueError

Expected result with a single element. Got: {result}

Error message

Expected result with a single element. Got: {result}

What it means

Error "Expected result with a single element. Got: {result}" thrown in roboflow/supervision.

Source

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

    Args:
        result: dict containing the model output
        resolution_wh: (output_width, output_height) to which we rescale the boxes.

    Returns:
        A tuple of `(xyxy, labels, masks, obb_boxes)` where `xyxy` is an array
            of shape `(n, 4)` in format `[x1, y1, x2, y2]`, `labels` is an
            optional array of shape `(n,)` with class labels, `masks` is an
            optional array of shape `(n, h, w)` with segmentation masks, and
            `obb_boxes` is an optional array of shape `(n, 4, 2)` with oriented
            bounding boxes.

    Raises:
        ValueError: If the top-level Florence 2 payload has multiple tasks or
            if a task payload is malformed.
    """
    if len(result) != 1:
        raise ValueError(f"Expected result with a single element. Got: {result}")
    task = next(iter(result.keys()))
    if task not in SUPPORTED_TASKS_FLORENCE_2:
        raise ValueError(
            f"{task} not supported. Supported tasks are: {SUPPORTED_TASKS_FLORENCE_2}"
        )
    result = result[task]

    if task in ["<OD>", "<CAPTION_TO_PHRASE_GROUNDING>", "<DENSE_REGION_CAPTION>"]:
        xyxy = np.array(result["bboxes"], dtype=np.float32)
        labels = np.array(result["labels"])
        return xyxy, labels, None, None

    if task == "<REGION_PROPOSAL>":
        xyxy = np.array(result["bboxes"], dtype=np.float32)
        # provides labels, but they are ["", "", "", ...]
        return xyxy, None, None, None

    if task == "<OCR_WITH_REGION>":

View on GitHub (pinned to 7f254d9784)

Solutions

  1. Pass a result containing exactly one element; index into batched model output first, e.g. result[0].
  2. If you batch inference, loop over the results and call the connector once per single result.

When it happens

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