{"record":{"id":"15dd8c51d3e86b1d","repo":"roboflow/supervision","slug":"unsupported-position-position-15dd8c","errorCode":null,"errorMessage":"Unsupported position: {position}","messagePattern":"Unsupported position: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/annotators/core.py","lineNumber":2967,"sourceCode":"            return (cx - width // 2, cy), (cx + width // 2, cy - height)\n        elif position == Position.TOP_RIGHT:\n            return (cx, cy), (cx + width, cy - height)\n        elif position == Position.CENTER_LEFT:\n            return (cx - width, cy - height // 2), (cx, cy + height // 2)\n        elif position == Position.CENTER or position == Position.CENTER_OF_MASS:\n            return (\n                (cx - width // 2, cy - height // 2),\n                (cx + width // 2, cy + height // 2),\n            )\n        elif position == Position.CENTER_RIGHT:\n            return (cx, cy - height // 2), (cx + width, cy + height // 2)\n        elif position == Position.BOTTOM_LEFT:\n            return (cx - width, cy), (cx, cy + height)\n        elif position == Position.BOTTOM_CENTER:\n            return (cx - width // 2, cy), (cx + width // 2, cy + height)\n        elif position == Position.BOTTOM_RIGHT:\n            return (cx, cy), (cx + width, cy + height)\n        raise ValueError(f\"Unsupported position: {position}\")\n\n    @staticmethod\n    def _validate_custom_values(\n        custom_values: npt.NDArray[np.float64] | list[float] | None,\n        detections: Detections,\n    ) -> None:\n        if custom_values is None:\n            if detections.confidence is None:\n                raise ValueError(\n                    \"The provided detections do not contain confidence values. \"\n                    \"Please provide `custom_values` or ensure that the detections \"\n                    \"contain confidence values (e.g. by using a different model).\"\n                )\n\n        else:\n            if not isinstance(custom_values, (np.ndarray, list)):\n                raise TypeError(\n                    \"custom_values must be either a numpy array or a list of floats.\"","sourceCodeStart":2949,"sourceCodeEnd":2985,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/annotators/core.py#L2949-L2985","documentation":"Raised by a static position-resolution helper in `PercentageBarAnnotator` when the supplied `position` is not one of the handled `sv.Position` members (TOP_LEFT, TOP_RIGHT, CENTER, CENTER_LEFT, CENTER_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT). The if/elif chain exhausts the known enum values and raises for anything else — normally only reachable with a non-enum value.","triggerScenarios":"Passing a raw string like `position=\"BOTTOM\"` (not the enum `sv.Position.BOTTOM_CENTER`) to the PercentageBarAnnotator constructor; passing a custom int or a mock object as position; passing `None`. The enum comparison uses equality, so unmatched values fall through every branch to the raise.","commonSituations":"Loading annotator config from JSON/YAML where position arrives as a string and is not converted with `sv.Position(...)`; using a Position member added in a newer supervision version while running an older version that lacks a branch for it; typos in position names in config files.","solutions":["Convert config strings to the enum before constructing: `sv.Position[str.upper()]` or a mapping dict.","Pin/upgrade supervision so the installed version knows every Position member you use.","Check the value is a member first: `assert position in sv.Position.__members__.values()` or use `sv.Position(position)` which validates."],"exampleFix":"# before\nannotator = sv.PercentageBarAnnotator(position=\"BOTTOM_CENTER\")  # str, not enum -> ValueError\n\n# after\nannotator = sv.PercentageBarAnnotator(position=sv.Position.BOTTOM_CENTER)","handlingStrategy":"type-guard","validationCode":"position = position if isinstance(position, sv.Position) else sv.Position[str(position).upper()]","typeGuard":"def as_position(v) -> sv.Position:\n    if isinstance(v, sv.Position):\n        return v\n    try:\n        return sv.Position[str(v).upper()]\n    except KeyError:\n        raise ValueError(f\"unknown position: {v!r}\") from None","tryCatchPattern":null,"preventionTips":["Always pass sv.Position enum members, never raw strings from config.","Convert deserialized config values through sv.Position[...] at load time."],"tags":["annotators","position","enum"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}