sgl-project/sglang · error · ValueError

processor_config.{key} must be set for MiMo-V2

Error message

processor_config.{key} must be set for MiMo-V2

What it means

Raised by _require_config_value during MiMoProcessor.__init__ when processor_config lacks a mandatory key (value is None). Required keys include vision_start_token_id and friends; the message names the exact missing key.

Source

Thrown at python/sglang/srt/multimodal/processors/mimo_v2.py:1492

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,
            Modality.VIDEO: 0,
            Modality.AUDIO: 0,
        }
        for text_part in text_parts:
            if multimodal_tokens_pattern.match(text_part):
                modality = self.mm_tokens.get_modality_of_token(text_part)

View on GitHub (pinned to 0132848349)

Solutions

  1. Add the missing key named in the message to processor_config with the correct token id from the model's tokenizer_config/preprocessor_config
  2. Load the full preprocessor_config.json shipped with the checkpoint rather than a subset
  3. If the checkpoint genuinely lacks the field, use a MiMo-V2-compatible checkpoint revision

Example fix

# before: processor_config = {'fps': 2.0}
# after
processor_config = {
  'fps': 2.0,
  'vision_start_token_id': tokenizer.convert_tokens_to_ids('<|vision_start|>'),
  # ...other required keys...
}
Defensive patterns

Strategy: validation

Validate before calling

REQUIRED = ['vision_start_token_id', 'vision_end_token_id', 'image_token_id', 'video_token_id', 'audio_token_id']
missing = [k for k in REQUIRED if processor_config.get(k) is None]
assert not missing, f'processor_config missing: {missing}'

Try / catch

try:
    proc = MiMoProcessor(hf_config, server_args, _processor)
except ValueError as e:
    if 'must be set for MiMo-V2' in str(e):
        key = re.search(r'processor_config\.(\w+)', str(e)).group(1)
        processor_config.setdefault(key, tokenizer.convert_tokens_to_ids(f'<|{key.replace("_token_id", "")}|>'))
        proc = MiMoProcessor(hf_config, server_args, _processor)
    else:
        raise

Prevention

When it happens

Trigger: Building MiMoProcessor from a processor_config dict that omits a required field (e.g. 'vision_start_token_id'), because the checkpoint's preprocessor_config.json is incomplete or the key name changed.

Common situations: Hand-edited or trimmed preprocessor configs; older checkpoints predating required fields; configs migrated between naming conventions (e.g. image_start_token_id vs vision_start_token_id).

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/0a7447126675e9bf. Report an issue: GitHub.