{"record":{"id":"02627025b34c629d","repo":"sgl-project/sglang","slug":"unsupported-model-type-model-type-026270","errorCode":null,"errorMessage":"Unsupported model type: {model_type}","messagePattern":"Unsupported model type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/parser/reasoning_parser.py","lineNumber":1976,"sourceCode":"        \"inkling\": InklingDetector,\n        \"cohere_command4\": CohereCommand4Detector,\n    }\n\n    def __init__(\n        self,\n        model_type: Optional[str] = None,\n        stream_reasoning: bool = True,\n        force_reasoning: Optional[bool] = None,\n        request: ChatCompletionRequest = None,\n        tokenizer=None,\n        tool_call_parser_active: bool = False,\n    ):\n        if not model_type:\n            raise ValueError(\"Model type must be specified\")\n\n        detector_class = self.DetectorMap.get(model_type.lower())\n        if not detector_class:\n            raise ValueError(f\"Unsupported model type: {model_type}\")\n\n        chat_template_kwargs = getattr(request, \"chat_template_kwargs\", None) or {}\n\n        # Special cases where we override force_reasoning\n        if model_type.lower() in {\n            \"qwen3-thinking\",\n            \"gpt-oss\",\n            \"minimax\",\n        }:\n            force_reasoning = True\n\n        # M3 consumes the <mm:think> start tag only for thinking_mode=enabled\n        # (absent from output → must force); mirror serving_chat's M3 branch.\n        if model_type.lower() == \"minimax-m3\" and force_reasoning is None:\n            force_reasoning = chat_template_kwargs.get(\"thinking_mode\") == \"enabled\"\n\n        # Only pass force_reasoning if explicitly set, let detectors use their defaults\n        kwargs = {\"stream_reasoning\": stream_reasoning}","sourceCodeStart":1958,"sourceCodeEnd":1994,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/parser/reasoning_parser.py#L1958-L1994","documentation":"ReasoningParser looks up model_type.lower() in its DetectorMap; an unrecognized name raises this ValueError listing the offending type. The map keys are per-model detector names (e.g. qwen3-thinking, deepseek-r1), not arbitrary model names.","triggerScenarios":"Passing a model name that has no registered reasoning detector, e.g. ReasoningParser(model_type='llama-3') or a typo like 'deepseek_r1'.","commonSituations":"New or uncommon models lacking a reasoning parser, casing/underscore mismatches, or version drift where a detector name was renamed between releases.","solutions":["Check ReasoningParser.DetectorMap keys and use an exact (case-insensitive) match","Fix typos/underscores — names use hyphens like 'deepseek-r1'","If the model genuinely has no reasoning format, don't enable the reasoning parser for it","Update sglang to a version that registers your model's detector"],"exampleFix":"// before\nparser = ReasoningParser(model_type=\"deepseek_r1\")\n// after\nparser = ReasoningParser(model_type=\"deepseek-r1\")","handlingStrategy":"validation","validationCode":"supported = set(map(str.lower, ReasoningParser.DetectorMap.keys()))\nif model_type.lower() not in supported:\n    raise ValueError(f\"unsupported; choose from {sorted(supported)}\")","typeGuard":"def is_supported_reasoning_model(mt: str) -> TypeGuard[str]:\n    return mt.lower() in ReasoningParser.DetectorMap","tryCatchPattern":"try:\n    parser = ReasoningParser(model_type=model_type)\nexcept ValueError as e:\n    if \"Unsupported model type\" in str(e):\n        parser = None  # run without reasoning parsing\n    else:\n        raise","preventionTips":["Cross-check parser names against DetectorMap on startup","Pin the sglang version whose detector list matches your models","Don't enable reasoning parsing for models without reasoning output"],"tags":["reasoning-parser","model-type","unsupported-model"],"backgroundTag":"unsupported-model-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}