{"record":{"id":"d6bfc0290cc57369","repo":"roboflow/supervision","slug":"anchor-is-not-supported","errorCode":null,"errorMessage":"{anchor} is not supported.","messagePattern":"(.+?) is not supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/detection/core.py","lineNumber":2610,"sourceCode":"            return calculate_masks_centroids(masks=self.mask)\n        elif anchor == Position.CENTER_LEFT:\n            return coordinates(xyxy[:, 0], (xyxy[:, 1] + xyxy[:, 3]) / 2)\n        elif anchor == Position.CENTER_RIGHT:\n            return coordinates(xyxy[:, 2], (xyxy[:, 1] + xyxy[:, 3]) / 2)\n        elif anchor == Position.BOTTOM_CENTER:\n            return coordinates((xyxy[:, 0] + xyxy[:, 2]) / 2, xyxy[:, 3])\n        elif anchor == Position.BOTTOM_LEFT:\n            return coordinates(xyxy[:, 0], xyxy[:, 3])\n        elif anchor == Position.BOTTOM_RIGHT:\n            return coordinates(xyxy[:, 2], xyxy[:, 3])\n        elif anchor == Position.TOP_CENTER:\n            return coordinates((xyxy[:, 0] + xyxy[:, 2]) / 2, xyxy[:, 1])\n        elif anchor == Position.TOP_LEFT:\n            return coordinates(xyxy[:, 0], xyxy[:, 1])\n        elif anchor == Position.TOP_RIGHT:\n            return coordinates(xyxy[:, 2], xyxy[:, 1])\n\n        raise ValueError(f\"{anchor} is not supported.\")\n\n    def get_data(self, key: str) -> _DetectionDataValueType | None:\n        \"\"\"Get a value from the detection data dictionary.\n\n        Args:\n            key: Data field name.\n\n        Returns:\n            The stored data value, or `None` when the key is absent.\n\n        Example:\n            ```pycon\n            >>> import numpy as np\n            >>> from supervision import Detections\n            >>> detections = Detections(\n            ...     xyxy=np.array([[0, 0, 1, 1]]),\n            ...     data={\"class_name\": np.array([\"cat\"])},\n            ... )","sourceCodeStart":2592,"sourceCodeEnd":2628,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/detection/core.py#L2592-L2628","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a sv.Position enum member that the method supports (e.g. sv.Position.CENTER, TOP_LEFT, BOTTOM_CENTER, ...).","Print the supported set for your version: [p for p in sv.Position] and verify the member you use is handled.","Upgrade supervision if you need a Position variant only newer versions map.","For custom anchors, compute coordinates yourself from detections.xyxy instead of relying on the enum."],"exampleFix":"# before\npts = dets.get_anchor_coordinates(\"bottom_center\")\n\n# after\nimport supervision as sv\npts = dets.get_anchor_coordinates(sv.Position.BOTTOM_CENTER)","handlingStrategy":"type-guard","validationCode":"import supervision as sv\nassert isinstance(anchor, sv.Position), f\"anchor must be sv.Position, got {anchor!r}\"","typeGuard":"import supervision as sv\n\ndef is_position(value) -> bool:\n    return isinstance(value, sv.Position)","tryCatchPattern":"try:\n    pts = dets.get_anchor_coordinates(anchor)\nexcept ValueError as e:\n    if \"is not supported\" in str(e):\n        pts = dets.get_anchor_coordinates(sv.Position.CENTER)\n    else:\n        raise","preventionTips":["Pass sv.Position enum members, not strings — even ones that look identical.","Verify the member you use is handled by your installed supervision version (enum membership alone is not enough on old versions).","For exotic anchors, compute coordinates directly from dets.xyxy."],"tags":["detections","anchor","position","enum","api-contract"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}