{"record":{"id":"5f079917a3868f9c","repo":"sgl-project/sglang","slug":"name-must-be-a-dict-like-config-got-type-confi","errorCode":null,"errorMessage":"{name} must be a dict-like config, got {type(config)}","messagePattern":"(.+?) must be a dict-like config, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/mimo_v2.py","lineNumber":1486,"sourceCode":"            raise ValueError(\n                f\"Unrecognized image input, support local path, http url, base64 and PIL.Image, got {image}\"\n            )\n        image = cls.to_rgb(image_obj)\n        return image\n\n\nclass MiMoV2Processor(BaseMultimodalProcessor):\n    models = [MiMoV2ForCausalLM]\n\n    @staticmethod\n    def _normalize_config_dict(config, name: str) -> dict:\n        if config is None:\n            return {}\n        if isinstance(config, dict):\n            return config\n        if hasattr(config, \"to_dict\"):\n            return config.to_dict()\n        raise ValueError(f\"{name} must be a dict-like config, got {type(config)}\")\n\n    @staticmethod\n    def _require_config_value(config: dict, key: str):\n        value = config.get(key)\n        if value is None:\n            raise ValueError(f\"processor_config.{key} must be set for MiMo-V2\")\n        return value\n\n    def _validate_placeholder_counts(\n        self,\n        text_parts,\n        multimodal_tokens_pattern,\n        image_count: int,\n        video_count: int,\n        audio_count: int,\n    ):\n        counts = {\n            Modality.IMAGE: 0,","sourceCodeStart":1468,"sourceCodeEnd":1504,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/mimo_v2.py#L1468-L1504","documentation":"Raised by _normalize_config_dict during MiMoProcessor.__init__ when a config argument is not None, not a dict, and has no to_dict() method. The processor accepts dict-like configs (including HF objects exposing to_dict) and rejects anything else with the offending type in the message.","triggerScenarios":"Constructing MiMoProcessor with processor_config (or a sibling config) as a string path, a dataclass without to_dict, a Namespace, or a list instead of a dict/HF config object.","commonSituations":"Programmatic construction in tests passing config paths; HF transformers version changes where configs no longer expose to_dict; custom wrappers passing **kwargs-wrapped values.","solutions":["Pass a plain dict or an HF configuration object (which has .to_dict())","If you have a JSON path, load it first: json.load(open(path))","Check {type(config)} in the message to find which argument is malformed"],"exampleFix":"# before\nproc = MiMoProcessor(hf_config, server_args, _processor, processor_config='preprocessor_config.json')\n# after\nimport json\nproc = MiMoProcessor(hf_config, server_args, _processor,\n                     processor_config=json.load(open('preprocessor_config.json')))","handlingStrategy":"validation","validationCode":"def normalize_cfg(cfg, name):\n    if cfg is None: return {}\n    if isinstance(cfg, dict): return cfg\n    if hasattr(cfg, 'to_dict'): return cfg.to_dict()\n    raise ValueError(f'{name} must be dict-like, got {type(cfg)}')\n\nprocessor_config = normalize_cfg(processor_config, 'processor_config')","typeGuard":"def is_dict_like_config(c) -> bool:\n    return c is None or isinstance(c, dict) or hasattr(c, 'to_dict')","tryCatchPattern":"try:\n    proc = MiMoProcessor(hf_config, server_args, _processor, processor_config=cfg)\nexcept ValueError as e:\n    if 'dict-like config' in str(e) and hasattr(cfg, '__dict__'):\n        proc = MiMoProcessor(hf_config, server_args, _processor, processor_config=dict(vars(cfg)))\n    else:\n        raise","preventionTips":["Always json.load config files before passing them","Pass HF config objects or plain dicts only","Add a startup assertion on config types"],"tags":["config","type-error","initialization"],"backgroundTag":"invalid-config-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}