{"record":{"id":"d8334a4578f14803","repo":"sgl-project/sglang","slug":"unknown-image-mode-mode-supported-supported","errorCode":null,"errorMessage":"Unknown image_mode '{mode}'. Supported: {supported}","messagePattern":"Unknown image_mode '(.+?)'\\. Supported: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/unlimited_ocr.py","lineNumber":39,"sourceCode":"    \"base\": (1024, 1024, False),\n    \"large\": (1280, 1280, False),\n    \"gundam\": (1024, 640, True),\n}\n_DEFAULT_MODE = \"gundam\"\n\n\ndef _resolve_mode(images_config, num_images: int = 1) -> dict:\n    \"\"\"Return processor kwargs from images_config (or default).\"\"\"\n    mode = _DEFAULT_MODE\n    if images_config:\n        mode = images_config.get(\"image_mode\", _DEFAULT_MODE)\n    key = mode.strip().lower()\n    preset = _IMAGE_MODE_PRESETS.get(key)\n    if preset is None:\n        logger.error(\n            f\"Unknown image_mode '{mode}'. Supported: {', '.join(_IMAGE_MODE_PRESETS)}\"\n        )\n        raise ValueError(\n            f\"Unknown image_mode '{mode}'. \"\n            f\"Supported: {', '.join(_IMAGE_MODE_PRESETS)}\"\n        )\n    _MULTI_IMAGE_ALLOWED = (\"tiny\", \"small\", \"base\")\n    base_size, image_size, crop_mode = preset\n    if num_images > 1 and key not in _MULTI_IMAGE_ALLOWED:\n        raise ValueError(\n            f\"image_mode='{mode}' is not supported with multiple images \"\n            f\"(got {num_images} images). \"\n            f\"Please use one of: {list(_MULTI_IMAGE_ALLOWED)}\"\n        )\n    return dict(zip((\"base_size\", \"image_size\", \"crop_mode\"), preset))\n\n\nclass UnlimitedOCRProcessor(BaseMultimodalProcessor):\n    \"\"\"Multimodal processor for UNLIMITED-OCR model.\"\"\"\n\n    models = [UnlimitedOCRForCausalLM]","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/unlimited_ocr.py#L21-L57","documentation":"The unlimited OCR multimodal processor maps a named image_mode (e.g. 'tiny', 'small', 'base') to a (base_size, image_size, crop_mode) preset. An unrecognized mode string — after strip/lower normalization — logs the supported list and raises ValueError. The supported set is fixed by _IMAGE_MODE_PRESETS.","triggerScenarios":"Passing image_mode like 'high', 'hd', 'auto', or a misspelled preset ('Bas') to the processor's process_mm_data_async; the key lookup in _IMAGE_MODE_PRESETS returns None.","commonSituations":"Copy-pasting image_mode values from other models' APIs (e.g. Qwen-VL 'high'/'low'); passing extra flags like 'max' expecting resolution tiers; version drift where presets were renamed.","solutions":["Use one of the presets printed in the error (from _IMAGE_MODE_PRESETS keys, e.g. tiny/small/base)","Omit image_mode to use the default","Upgrade sglang if docs mention a mode your version lacks"],"exampleFix":"# before\nprocessor.process_mm_data_async(..., image_mode='high')\n# after\nprocessor.process_mm_data_async(..., image_mode='base')","handlingStrategy":"validation","validationCode":"SUPPORTED = {'tiny', 'small', 'base'}  # from _IMAGE_MODE_PRESETS\nif image_mode.strip().lower() not in SUPPORTED:\n    raise ValueError(f'image_mode must be one of {SUPPORTED}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Surface the supported mode list in your API schema","Normalize mode strings (strip/lower) client-side before sending"],"tags":["multimodal","ocr","invalid-argument","config-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}