{"record":{"id":"6ff73f076de64bbd","repo":"roboflow/supervision","slug":"anchor-is-not-supported-6ff73f","errorCode":null,"errorMessage":"{anchor} is not supported.","messagePattern":"(.+?) is not supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/detection/utils/boxes.py","lineNumber":387,"sourceCode":"\n    Examples:\n        ```pycon\n        >>> import numpy as np\n        >>> from supervision.detection.utils.boxes import _oriented_box_anchors\n        >>> from supervision.geometry.core import Position\n        >>> corners = np.array(\n        ...     [[[0, 0], [10, 0], [10, 4], [0, 4]]], dtype=np.float32\n        ... )\n        >>> _oriented_box_anchors(corners, Position.BOTTOM_CENTER)\n        array([[5., 4.]])\n\n        ```\n    \"\"\"\n    corners = np.asarray(xyxyxyxy, dtype=np.float64)\n    if corners.ndim != 3 or corners.shape[-2:] != (4, 2):\n        raise ValueError(f\"xyxyxyxy must have shape (N, 4, 2); got {corners.shape}\")\n    if anchor not in _ANCHOR_OFFSETS:\n        raise ValueError(f\"{anchor} is not supported.\")\n    sx, sy = _ANCHOR_OFFSETS[anchor]\n\n    center = corners.mean(axis=1)\n    # Two perpendicular half-side vectors per box.\n    half_side_a = (corners[:, 1] - corners[:, 0]) / 2\n    half_side_b = (corners[:, 2] - corners[:, 1]) / 2\n\n    # Map each box's own sides onto the image axes: the side more aligned with\n    # the x-axis plays the role of width, the other of height. This makes the\n    # offsets collapse to the axis-aligned frame when the box is not rotated.\n    is_width = np.abs(half_side_a[:, 0]) >= np.abs(half_side_b[:, 0])\n    width = np.where(is_width[:, None], half_side_a, half_side_b)\n    height = np.where(is_width[:, None], half_side_b, half_side_a)\n    # Point width toward +x and height toward +y so the offset signs are stable.\n    width = np.where((width[:, 0] < 0)[:, None], -width, width)\n    height = np.where((height[:, 1] < 0)[:, None], -height, height)\n\n    return cast(npt.NDArray[np.float64], center + sx * width + sy * height)","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/detection/utils/boxes.py#L369-L405","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\n_oriented_box_anchors(corners, Position.TOP_RIGHT)  # ValueError: not supported\n\n# after\n_oriented_box_anchors(corners, Position.CENTER)","handlingStrategy":"validation","validationCode":"from supervision.detection.utils.boxes import _ANCHOR_OFFSETS\n\nif position not in _ANCHOR_OFFSETS:\n    position = sv.Position.CENTER  # or raise a config error\nanchors = _oriented_box_anchors(corners, position)","typeGuard":"def is_supported_obb_anchor(p) -> bool:\n    from supervision.detection.utils.boxes import _ANCHOR_OFFSETS\n    return p in _ANCHOR_OFFSETS","tryCatchPattern":"try:\n    anchors = _oriented_box_anchors(corners, position)\nexcept ValueError as err:\n    if 'not supported' in str(err):\n        anchors = _oriented_box_anchors(corners, sv.Position.CENTER)\n    else:\n        raise","preventionTips":["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."],"tags":["anchors","position","oriented-bounding-box","enum","valueerror"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}