sgl-project/sglang · error · ValueError
{name} must be a dict-like config, got {type(config)}
Error message
{name} must be a dict-like config, got {type(config)} What it means
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.
Source
Thrown at python/sglang/srt/multimodal/processors/mimo_v2.py:1486
raise ValueError(
f"Unrecognized image input, support local path, http url, base64 and PIL.Image, got {image}"
)
image = cls.to_rgb(image_obj)
return image
class MiMoV2Processor(BaseMultimodalProcessor):
models = [MiMoV2ForCausalLM]
@staticmethod
def _normalize_config_dict(config, name: str) -> dict:
if config is None:
return {}
if isinstance(config, dict):
return config
if hasattr(config, "to_dict"):
return config.to_dict()
raise ValueError(f"{name} must be a dict-like config, got {type(config)}")
@staticmethod
def _require_config_value(config: dict, key: str):
value = config.get(key)
if value is None:
raise ValueError(f"processor_config.{key} must be set for MiMo-V2")
return value
def _validate_placeholder_counts(
self,
text_parts,
multimodal_tokens_pattern,
image_count: int,
video_count: int,
audio_count: int,
):
counts = {
Modality.IMAGE: 0,View on GitHub (pinned to 0132848349)
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
Example fix
# before
proc = MiMoProcessor(hf_config, server_args, _processor, processor_config='preprocessor_config.json')
# after
import json
proc = MiMoProcessor(hf_config, server_args, _processor,
processor_config=json.load(open('preprocessor_config.json'))) Defensive patterns
Strategy: validation
Validate before calling
def normalize_cfg(cfg, name):
if cfg is None: return {}
if isinstance(cfg, dict): return cfg
if hasattr(cfg, 'to_dict'): return cfg.to_dict()
raise ValueError(f'{name} must be dict-like, got {type(cfg)}')
processor_config = normalize_cfg(processor_config, 'processor_config') Type guard
def is_dict_like_config(c) -> bool:
return c is None or isinstance(c, dict) or hasattr(c, 'to_dict') Try / catch
try:
proc = MiMoProcessor(hf_config, server_args, _processor, processor_config=cfg)
except ValueError as e:
if 'dict-like config' in str(e) and hasattr(cfg, '__dict__'):
proc = MiMoProcessor(hf_config, server_args, _processor, processor_config=dict(vars(cfg)))
else:
raise Prevention
- Always json.load config files before passing them
- Pass HF config objects or plain dicts only
- Add a startup assertion on config types
When it happens
Trigger: 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.
Common situations: Programmatic construction in tests passing config paths; HF transformers version changes where configs no longer expose to_dict; custom wrappers passing **kwargs-wrapped values.
Related errors
- cache_dit_params must be a dict, got {type(raw).__name__}.
- Invalid component residency assignment: {value!r}
- Invalid component residency assignment: {raw_selector!r}={ra
- component_attention_backends must be a dict or a comma-separ
- Component attention backend key must be a string
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5f079917a3868f9c.
Report an issue: GitHub.