{"record":{"id":"1f9b11f0f2606b8b","repo":"roboflow/supervision","slug":"invalid-vlm-value-vlm-must-be-one-of-e-value","errorCode":null,"errorMessage":"Invalid vlm value: {vlm}. Must be one of {[e.value for e in VLM]}","messagePattern":"Invalid vlm value: (.+?)\\. Must be one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/detection/vlm.py","lineNumber":190,"sourceCode":"    \"\"\"\n    Validates the parameters and result type for a given Vision-Language Model (VLM).\n\n    Args:\n        vlm: The VLM enum or string specifying the model.\n        result: The result object to validate (type depends on VLM).\n        kwargs: Dictionary of arguments to validate against required/allowed lists.\n\n    Returns:\n        The validated VLM enum value.\n\n    Raises:\n        ValueError: If the VLM, result type, or arguments are invalid.\n    \"\"\"\n    if isinstance(vlm, str):\n        try:\n            vlm = VLM(vlm.lower())\n        except ValueError:\n            raise ValueError(\n                f\"Invalid vlm value: {vlm}. Must be one of {[e.value for e in VLM]}\"\n            )\n\n    if not isinstance(result, RESULT_TYPES[vlm]):\n        raise ValueError(\n            f\"Invalid VLM result type: {type(result)}. Must be {RESULT_TYPES[vlm]}\"\n        )\n\n    required_args = REQUIRED_ARGUMENTS.get(vlm, [])\n    for arg in required_args:\n        if arg not in kwargs:\n            raise ValueError(f\"Missing required argument: {arg}\")\n\n    allowed_args = ALLOWED_ARGUMENTS.get(vlm, [])\n    for arg in kwargs:\n        if arg not in allowed_args:\n            raise ValueError(f\"Argument {arg} is not allowed for {vlm.name}\")\n","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/detection/vlm.py#L172-L208","documentation":"Raised by the VLM argument validator in supervision's VLM module when the vlm argument is a string that does not match any VLM enum value after lowercasing. Supported values mirror VLM members (e.g. 'paligemma', 'florence-2', 'qwen-2.5-vl', 'qwen-3-vl', 'deepseek-vl2'). A VLM enum instance or an exactly-matching string are the only accepted inputs.","triggerScenarios":"Calling sv.Detections.from_vlm(vlm='florence2', result=...) (missing hyphen), 'Qwen2.5-VL' style names, or a made-up model name; the lookup VLM(vlm.lower()) raises ValueError internally which is re-raised with the supported list.","commonSituations":"Using the HuggingFace model id ('microsoft/Florence-2-large') instead of the enum value; version drift when new VLMs were added/renamed across supervision releases; copy-pasting names from older docs that used the deprecated LMM enum values.","solutions":["Pass the enum member instead of a string: sv.detection.vlm.VLM.FLORENCE_2, which is immune to spelling issues.","If using a string, copy it exactly from the error message's supported list (e.g. 'florence-2').","Check the VLM enum in your installed version: python -c \"from supervision.detection.vlm import VLM; print(VLM.list())\".","Upgrade supervision if you expect a model whose value is not in the list."],"exampleFix":"# before\n detections = sv.Detections.from_vlm(vlm=\"florence2\", result=result)\n\n# after\n from supervision.detection.vlm import VLM\n detections = sv.Detections.from_vlm(vlm=VLM.FLORENCE_2, result=result)","handlingStrategy":"validation","validationCode":"from supervision.detection.vlm import VLM\n\nvalid = {e.value for e in VLM}\nif vlm_name.strip().lower() not in valid:\n    raise ValueError(f\"Unsupported VLM {vlm_name!r}; valid: {sorted(valid)}\")","typeGuard":"def is_valid_vlm_name(name: str) -> bool:\n    return name.strip().lower() in {e.value for e in VLM}","tryCatchPattern":"try:\n    detections = sv.Detections.from_vlm(vlm=vlm_name, result=result)\nexcept ValueError as e:\n    raise SystemExit(f\"Configuration error: {e}\") from e","preventionTips":["Prefer passing the VLM enum member over strings.","Validate model names once at app startup, not per call.","Print VLM.list() after upgrading supervision."],"tags":["vlm","enum","validation","config"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}