{"record":{"id":"b15fbf5631a2e316","repo":"roboflow/supervision","slug":"unsupported-position-position","errorCode":null,"errorMessage":"Unsupported position: {position}","messagePattern":"Unsupported position: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/annotators/utils.py","lineNumber":130,"sourceCode":"            center_y,\n            center_x + text_w // 2,\n            center_y + text_h,\n        )\n    elif position == Position.CENTER_LEFT:\n        return (\n            center_x - text_w,\n            center_y - text_h // 2,\n            center_x,\n            center_y + text_h // 2,\n        )\n    elif position == Position.CENTER_RIGHT:\n        return (\n            center_x,\n            center_y - text_h // 2,\n            center_x + text_w,\n            center_y + text_h // 2,\n        )\n    raise ValueError(f\"Unsupported position: {position}\")\n\n\ndef get_color_by_index(color: Color | ColorPalette, idx: int) -> Color:\n    \"\"\"Resolve a color-like object to a concrete `Color` for an index.\"\"\"\n    color_like = cast(Any, color)\n    # Accept ColorPalette-like objects without depending on their exact concrete class.\n    if callable(getattr(color_like, \"by_idx\", None)):\n        color_like = color_like.by_idx(idx)\n    if isinstance(color_like, Color):\n        return color_like\n    return Color(\n        r=int(color_like.r),\n        g=int(color_like.g),\n        b=int(color_like.b),\n        a=int(getattr(color_like, \"a\", 255)),\n    )\n\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/annotators/utils.py#L112-L148","documentation":"Raised by resolve_text_background_xyxy() in supervision.annotators.utils when the `position` argument does not match any known Position enum branch (CENTER, CENTER_LEFT, CENTER_RIGHT, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, etc.). It is the terminal raise of the if/elif chain, so any unrecognized position value — usually a raw string or a custom enum — triggers it.","triggerScenarios":"Passing position='top_left' or Position.TOP_CENTER (unsupported member) to LabelAnnotator or any text-drawing helper; passing a coordinate tuple where the enum is expected.","commonSituations":"Config-driven annotator construction with unparsed strings; newer Position members used against older supervision; corner-position assumptions that are not implemented (e.g. CENTER_BOTTOM naming differences).","solutions":["Pass the enum: position=sv.Position.TOP_LEFT (import from supervision).","Check sv.Position.list() for the exact supported members in your installed version.","Map config strings to enums explicitly rather than passing them raw.","Upgrade/downgrade to the version whose Position members your code expects."],"exampleFix":"// before\nlabel_annotator = sv.LabelAnnotator(text_position='top_left')\n\n// after\nlabel_annotator = sv.LabelAnnotator(text_position=sv.Position.TOP_LEFT)","handlingStrategy":"validation","validationCode":"supported = set(sv.Position.list())\nif isinstance(position, str) and position.upper() in {p.upper() for p in supported}:\n    position = sv.Position(position.upper())\nassert getattr(position, 'value', position) in supported, position","typeGuard":"def is_supported_position(pos: object) -> bool:\n    return isinstance(pos, sv.Position)","tryCatchPattern":null,"preventionTips":["Print sv.Position.list() once to learn the exact supported members in your version.","Use sv.Position enum values in configs, converting strings at load time."],"tags":["annotators","enum","validation","position"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}