{"record":{"id":"bebeba108816342c","repo":"sgl-project/sglang","slug":"required-vision-config-model-type-is-not-found-i","errorCode":null,"errorMessage":"Required `vision_config.model_type` is not found in hf_config: `{hf_config}`","messagePattern":"Required `vision_config\\.model_type` is not found in hf_config: `(.+?)`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/llava.py","lineNumber":301,"sourceCode":"            if sgl_processor_cls:\n                return sgl_processor_cls[0]\n        raise ValueError(\n            f\"Cannot find corresponding multimodal processor registered in sglang for model type `{model_type}`\"\n        )\n\n    def __init__(self, hf_config, server_args, _processor, *args, **kwargs):\n        assert hasattr(hf_config, \"vision_config\")\n        assert hasattr(hf_config, \"text_config\")\n        self.vision_config = hf_config.vision_config\n        self.text_config = hf_config.text_config\n        self.hf_config = hf_config\n\n        if vision_type := getattr(self.vision_config, \"model_type\"):\n            self.inner = self._get_sgl_processor_cls(vision_type)(\n                hf_config, server_args, _processor, *args, **kwargs\n            )\n        else:\n            raise ValueError(\n                f\"Required `vision_config.model_type` is not found in hf_config: `{hf_config}`\"\n            )\n\n    async def process_mm_data_async(self, *args, **kwargs):\n        return await self.inner.process_mm_data_async(*args, **kwargs)\n","sourceCodeStart":283,"sourceCodeEnd":307,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/llava.py#L283-L307","documentation":"The LLaVA wrapper processor needs hf_config.vision_config.model_type to select the inner processor. The loaded HF config has a vision_config without a model_type field, so dispatch is impossible.","triggerScenarios":"Loading a model whose config.json contains vision_config but that dict lacks the model_type key (malformed or hand-edited config, or a checkpoint saved by an older transformers version).","commonSituations":"Merging checkpoints or editing configs manually drops vision_config.model_type; a quantized/converted repo ships an incomplete config.","solutions":["Inspect the model repo's config.json and confirm vision_config.model_type exists (e.g. \"siglip_vision_model\")","Fix or restore the missing key in config.json from the original base model repo","Re-download the model from a trusted mirror in case of a corrupted snapshot"],"exampleFix":"// config.json before\n\"vision_config\": {\"hidden_size\": 1152}\n// after\n\"vision_config\": {\"model_type\": \"siglip_vision_model\", \"hidden_size\": 1152}","handlingStrategy":"validation","validationCode":"cfg = json.load(open(model_dir / \"config.json\"))\nassert cfg.get(\"vision_config\", {}).get(\"model_type\"), \"vision_config.model_type missing\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate config.json structure after downloading or merging checkpoints","Keep a reference config from the base model to diff against"],"tags":["multimodal","config","model-loading","missing-field"],"backgroundTag":"missing-model-config-field","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}