{"record":{"id":"4048bf96d74f6822","repo":"BerriAI/litellm","slug":"invalid-detail-value-detail-expected-low-h","errorCode":null,"errorMessage":"Invalid detail value: {detail}. Expected 'low', 'high', or 'auto'.","messagePattern":"Invalid detail value: (.+?)\\. Expected 'low', 'high', or 'auto'\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/token_counter.py","lineNumber":589,"sourceCode":"    use_default_image_token_count: bool,\n) -> int:\n    \"\"\"\n    Count tokens for an image_url content block.\n\n    Args:\n        image_url: The image URL data - can be a string URL or dict with 'url' and 'detail'\n        use_default_image_token_count: Whether to use default image token counts\n\n    Returns:\n        int: Number of tokens for the image\n\n    Raises:\n        ValueError: If image_url is invalid type or detail value is invalid\n    \"\"\"\n    if isinstance(image_url, dict):\n        detail: Final = image_url.get(\"detail\", \"auto\")\n        if detail not in [\"low\", \"high\", \"auto\"]:\n            raise ValueError(f\"Invalid detail value: {detail}. Expected 'low', 'high', or 'auto'.\")\n        url: Final = image_url.get(\"url\")\n        if not url:\n            raise ValueError(\"Missing required key 'url' in image_url dict.\")\n        return calculate_img_tokens(\n            data=url,\n            mode=detail,\n            use_default_image_token_count=use_default_image_token_count,\n        )\n    elif isinstance(image_url, str):\n        if not image_url.strip():\n            raise ValueError(\"Empty image_url string is not valid.\")\n        return calculate_img_tokens(\n            data=image_url,\n            mode=\"auto\",\n            use_default_image_token_count=use_default_image_token_count,\n        )\n    else:\n        raise ValueError(f\"Invalid image_url type: {type(image_url).__name__}. Expected str or dict with 'url' field.\")","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/token_counter.py#L571-L607","documentation":"Image token counting guard: an image_url dict's 'detail' field is not 'low', 'high', or 'auto', so the image token cost cannot be computed per OpenAI rules. Fires on invalid detail values in content blocks.","triggerScenarios":"Thrown at litellm/litellm_core_utils/token_counter.py:589 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set image detail to 'low', 'high', or 'auto'.","Fix the detail value in the image_url dict."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}