roboflow/supervision · error · ValueError
{anchor} is not supported.
Error message
{anchor} is not supported. What it means
Raised by _oriented_box_anchors when the given Position anchor is not a key in _ANCHOR_OFFSETS. Only a subset of Position values has a defined offset for oriented boxes (the map in boxes.py lists them, e.g. CENTER, CENTER_LEFT, BOTTOM_CENTER). Other Position enum members are valid elsewhere in supervision but have no oriented-box anchor mapping.
Source
Thrown at src/supervision/detection/utils/boxes.py:387
Examples:
```pycon
>>> import numpy as np
>>> from supervision.detection.utils.boxes import _oriented_box_anchors
>>> from supervision.geometry.core import Position
>>> corners = np.array(
... [[[0, 0], [10, 0], [10, 4], [0, 4]]], dtype=np.float32
... )
>>> _oriented_box_anchors(corners, Position.BOTTOM_CENTER)
array([[5., 4.]])
```
"""
corners = np.asarray(xyxyxyxy, dtype=np.float64)
if corners.ndim != 3 or corners.shape[-2:] != (4, 2):
raise ValueError(f"xyxyxyxy must have shape (N, 4, 2); got {corners.shape}")
if anchor not in _ANCHOR_OFFSETS:
raise ValueError(f"{anchor} is not supported.")
sx, sy = _ANCHOR_OFFSETS[anchor]
center = corners.mean(axis=1)
# Two perpendicular half-side vectors per box.
half_side_a = (corners[:, 1] - corners[:, 0]) / 2
half_side_b = (corners[:, 2] - corners[:, 1]) / 2
# Map each box's own sides onto the image axes: the side more aligned with
# the x-axis plays the role of width, the other of height. This makes the
# offsets collapse to the axis-aligned frame when the box is not rotated.
is_width = np.abs(half_side_a[:, 0]) >= np.abs(half_side_b[:, 0])
width = np.where(is_width[:, None], half_side_a, half_side_b)
height = np.where(is_width[:, None], half_side_b, half_side_a)
# Point width toward +x and height toward +y so the offset signs are stable.
width = np.where((width[:, 0] < 0)[:, None], -width, width)
height = np.where((height[:, 1] < 0)[:, None], -height, height)
return cast(npt.NDArray[np.float64], center + sx * width + sy * height)View on GitHub (pinned to 7f254d9784)
Solutions
- Use one of the supported anchors, e.g. Position.CENTER, Position.CENTER_LEFT, or Position.BOTTOM_CENTER — check the _ANCHOR_OFFSETS keys in boxes.py for the full list.
- If you need an unsupported anchor for OBBs, compute it yourself from corners[:, i] vertices instead of the helper.
- Keep a project-level allowlist of anchors and validate against it when config is shared between aligned and oriented pipelines.
Example fix
# before _oriented_box_anchors(corners, Position.TOP_RIGHT) # ValueError: not supported # after _oriented_box_anchors(corners, Position.CENTER)
Defensive patterns
Strategy: validation
Validate before calling
from supervision.detection.utils.boxes import _ANCHOR_OFFSETS
if position not in _ANCHOR_OFFSETS:
position = sv.Position.CENTER # or raise a config error
anchors = _oriented_box_anchors(corners, position) Type guard
def is_supported_obb_anchor(p) -> bool:
from supervision.detection.utils.boxes import _ANCHOR_OFFSETS
return p in _ANCHOR_OFFSETS Try / catch
try:
anchors = _oriented_box_anchors(corners, position)
except ValueError as err:
if 'not supported' in str(err):
anchors = _oriented_box_anchors(corners, sv.Position.CENTER)
else:
raise Prevention
- Maintain an allowlist of oriented-box anchors shared by your config validation.
- Treat Position as per-feature: values valid for aligned boxes may be unsupported for OBBs.
When it happens
Trigger: Calling an annotator or _oriented_box_anchors with a Position such as Position.TOP_RIGHT or any member not present in _ANCHOR_OFFSETS, while detections carry oriented bounding boxes.
Common situations: Reusing anchor config from axis-aligned code (where all Position values are accepted) with rotated-box detections; upgrading supervision and passing a newly added Position member that has not been added to the oriented-box map yet.
Related errors
- xyxyxyxy must have shape (N, 4, 2); got {corners.shape}
- {anchor} is not supported.
- corners must have shape (N, 4, 2); got {corners.shape}
- xyxyxyxy must have shape (N, 4, 2); got {xyxyxyxy.shape}
- Triggering anchors cannot be empty.
AI-assisted analysis of roboflow/supervision@7f254d9784 (2026-08-15).
Data as JSON: /api/errors/6ff73f076de64bbd.
Report an issue: GitHub.