roboflow/supervision · error · ValueError

{anchor} is not supported.

Error message

{anchor} is not supported.

What it means

Raised by Detections.get_anchor_coordinates when the anchor argument is not one of the supported Position enum members handled above the fall-through (the method maps each Position variant to an (x, y) rule derived from the xyxy boxes). Passing anything else — a raw string, a custom position, or an enum member added in a newer version than this branch handles — hits the unconditional ValueError.

Source

Thrown at src/supervision/detection/core.py:2610

            return calculate_masks_centroids(masks=self.mask)
        elif anchor == Position.CENTER_LEFT:
            return coordinates(xyxy[:, 0], (xyxy[:, 1] + xyxy[:, 3]) / 2)
        elif anchor == Position.CENTER_RIGHT:
            return coordinates(xyxy[:, 2], (xyxy[:, 1] + xyxy[:, 3]) / 2)
        elif anchor == Position.BOTTOM_CENTER:
            return coordinates((xyxy[:, 0] + xyxy[:, 2]) / 2, xyxy[:, 3])
        elif anchor == Position.BOTTOM_LEFT:
            return coordinates(xyxy[:, 0], xyxy[:, 3])
        elif anchor == Position.BOTTOM_RIGHT:
            return coordinates(xyxy[:, 2], xyxy[:, 3])
        elif anchor == Position.TOP_CENTER:
            return coordinates((xyxy[:, 0] + xyxy[:, 2]) / 2, xyxy[:, 1])
        elif anchor == Position.TOP_LEFT:
            return coordinates(xyxy[:, 0], xyxy[:, 1])
        elif anchor == Position.TOP_RIGHT:
            return coordinates(xyxy[:, 2], xyxy[:, 1])

        raise ValueError(f"{anchor} is not supported.")

    def get_data(self, key: str) -> _DetectionDataValueType | None:
        """Get a value from the detection data dictionary.

        Args:
            key: Data field name.

        Returns:
            The stored data value, or `None` when the key is absent.

        Example:
            ```pycon
            >>> import numpy as np
            >>> from supervision import Detections
            >>> detections = Detections(
            ...     xyxy=np.array([[0, 0, 1, 1]]),
            ...     data={"class_name": np.array(["cat"])},
            ... )

View on GitHub (pinned to 7f254d9784)

Solutions

  1. Pass a sv.Position enum member that the method supports (e.g. sv.Position.CENTER, TOP_LEFT, BOTTOM_CENTER, ...).
  2. Print the supported set for your version: [p for p in sv.Position] and verify the member you use is handled.
  3. Upgrade supervision if you need a Position variant only newer versions map.
  4. For custom anchors, compute coordinates yourself from detections.xyxy instead of relying on the enum.

Example fix

# before
pts = dets.get_anchor_coordinates("bottom_center")

# after
import supervision as sv
pts = dets.get_anchor_coordinates(sv.Position.BOTTOM_CENTER)
Defensive patterns

Strategy: type-guard

Validate before calling

import supervision as sv
assert isinstance(anchor, sv.Position), f"anchor must be sv.Position, got {anchor!r}"

Type guard

import supervision as sv

def is_position(value) -> bool:
    return isinstance(value, sv.Position)

Try / catch

try:
    pts = dets.get_anchor_coordinates(anchor)
except ValueError as e:
    if "is not supported" in str(e):
        pts = dets.get_anchor_coordinates(sv.Position.CENTER)
    else:
        raise

Prevention

When it happens

Trigger: Calling detections.get_anchor_coordinates("center") with a plain string that is not a Position; passing Position.CENTER_LEFT when that member exists on the enum but is not handled by this supervision version; passing None.

Common situations: Users passing strings like 'bottom_center' instead of sv.Position.BOTTOM_CENTER; version skew where code targets Position members introduced after the installed supervision; typos in the enum name.

Related errors


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