{"record":{"id":"54b0a2cf1fb7a52d","repo":"roboflow/supervision","slug":"invalid-value-value-must-be-one-of-cls-list-54b0a2","errorCode":null,"errorMessage":"Invalid value: {value}. Must be one of {cls.list()}","messagePattern":"Invalid value: (.+?)\\. Must be one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/detection/utils/iou_and_nms.py","lineNumber":48,"sourceCode":"\n    NONE = \"none\"\n    NON_MAX_SUPPRESSION = \"non_max_suppression\"\n    NON_MAX_MERGE = \"non_max_merge\"\n\n    @classmethod\n    def list(cls) -> list[str]:\n        return list(map(lambda member: member.value, cls))\n\n    @classmethod\n    def from_value(cls, value: OverlapFilter | str) -> OverlapFilter:\n        if isinstance(value, cls):\n            return value\n        if isinstance(value, str):\n            value = value.lower()\n            try:\n                return cls(value)\n            except ValueError:\n                raise ValueError(f\"Invalid value: {value}. Must be one of {cls.list()}\")\n        raise ValueError(\n            f\"Invalid value type: {type(value)}. Must be an instance of \"\n            f\"{cls.__name__} or str.\"\n        )\n\n\nclass OverlapMetric(Enum):\n    \"\"\"\n    Enum specifying the metric for measuring overlap between detections.\n\n    Attributes:\n        IOU: Intersection over Union. A region-overlap metric that compares\n            two shapes (usually bounding boxes or masks) by normalising the\n            shared area with the area of their union.\n        IOS: Intersection over Smaller, a region-overlap metric that compares\n            two shapes (usually bounding boxes or masks) by normalising the\n            shared area with the smaller of the two shapes.\n    \"\"\"","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/detection/utils/iou_and_nms.py#L30-L66","documentation":"`OverlapFilter.from_value` converts a user-supplied string into the `OverlapFilter` enum, which only accepts 'none', 'non_max_suppression', or 'non_max_merge' (case-insensitive). This error is raised when the lower-cased string matches no member — e.g. 'nms', 'non-max-suppression' (hyphens), or 'NON_MAX_MERGE '. The enum selects how overlapping detections are post-processed by `Detections.with_nms` and friends.","triggerScenarios":"Calling `detections.with_nms(threshold, overlap_filter='nms')` — the common abbreviation is not accepted; or passing 'non-max-merge' with hyphens from a CLI argument or config file.","commonSituations":"CLI flags and YAML configs using abbreviations ('nms', 'suppress') or hyphenated spellings; users assuming enum values mirror another library's naming.","solutions":["Use one of the exact values: 'none', 'non_max_suppression', 'non_max_merge' (any case), or the enum members `sv.OverlapFilter.NON_MAX_SUPPRESSION` / `NON_MAX_MERGE` / `NONE`.","Map user-facing shorthand to enum values at your CLI boundary: `{'nms': 'non_max_suppression', 'nmm': 'non_max_merge'}`.","Echo valid options to the user on failure: `sv.OverlapFilter.list()`."],"exampleFix":"# before\ndets = dets.with_nms(0.5, overlap_filter='nms')  # ValueError\n\n# after\ndets = dets.with_nms(0.5, overlap_filter=sv.OverlapFilter.NON_MAX_SUPPRESSION)","handlingStrategy":"validation","validationCode":"ALIASES = {'nms': 'non_max_suppression', 'nmm': 'non_max_merge', 'none': 'none'}\noverlap_filter = sv.OverlapFilter.from_value(ALIASES.get(raw.strip().lower(), raw.strip()))","typeGuard":"def is_overlap_filter_value(v) -> bool:\n    try:\n        OverlapFilter.from_value(v)\n        return True\n    except ValueError:\n        return False","tryCatchPattern":null,"preventionTips":["Remember underscores, not hyphens/abbreviations: 'non_max_suppression', 'non_max_merge'.","Show sv.OverlapFilter.list() in CLI help text."],"tags":["argument-validation","enum","nms","post-processing","detection"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}