{"record":{"id":"2f2a9eaa482424f5","repo":"sgl-project/sglang","slug":"anthropic-thinking-is-not-supported-for-models-wit","errorCode":null,"errorMessage":"Anthropic thinking is not supported for models without a reasoning parser","messagePattern":"Anthropic thinking is not supported for models without a reasoning parser","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"python/sglang/srt/entrypoints/openai/serving_chat.py","lineNumber":2370,"sourceCode":"        if mode in (\"thinking\", \"enable_thinking\"):\n            return mode\n        if mode in (\"explicit_thinking\", \"explicit_enable_thinking\"):\n            return mode.replace(\"explicit_\", \"\")\n        return None\n\n    def apply_reasoning_enabled(\n        self, request: ChatCompletionRequest, enabled: bool\n    ) -> None:\n        \"\"\"Force the request into the requested reasoning-on/off mode.\n\n        Mirrors the read-side logic in ``_get_reasoning_from_request``;\n        the two must stay in sync. Always-on models cannot be disabled,\n        so explicit ``enabled=False`` raises rather than silently leaving\n        reasoning on.\n        \"\"\"\n        if not self.reasoning_parser:\n            if enabled:\n                raise ValueError(\n                    \"Anthropic thinking is not supported for models without \"\n                    \"a reasoning parser\"\n                )\n            return\n\n        if self.reasoning_parser == \"hunyuan\":\n            request.reasoning_effort = \"medium\" if enabled else \"no_think\"\n            return\n\n        if self.reasoning_parser == \"inkling\":\n            # Effort-conditioned, not toggled: \"none\" (0.0) is the off switch.\n            if not enabled:\n                request.reasoning_effort = \"none\"\n                return\n\n        config = self.template_manager.reasoning_config\n        is_mistral = (config is not None and config.special_case == \"mistral\") or (\n            config is None and self._reasoning_default_mode() == \"mistral\"","sourceCodeStart":2352,"sourceCodeEnd":2388,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/entrypoints/openai/serving_chat.py#L2352-L2388","documentation":"An Anthropic-style request enabled thinking (enabled=True) but the served model has no reasoning parser configured, so the server cannot split/parse reasoning output. apply_reasoning_enabled raises to refuse producing unparsable thinking content.","triggerScenarios":"Anthropic-compatible request with thinking={\"type\":\"enabled\",...} while the server lacks --reasoning-parser for the model.","commonSituations":"Porting an Anthropic client to a non-reasoning model; enabling thinking flags unconditionally in a client harness; forgetting server-side --reasoning-parser.","solutions":["Launch server with the appropriate --reasoning-parser for a reasoning model","Send thinking enabled=False (or omit it) for non-reasoning models","Gate the thinking parameter in the client on model capability"],"exampleFix":"# before\nrequest.thinking = {\"type\": \"enabled\", \"budget_tokens\": 1024}  # model w/o parser\n# after\nrequest.thinking = None","handlingStrategy":"validation","validationCode":"if thinking_enabled and not server_has_reasoning_parser: thinking = None","typeGuard":"def can_enable_thinking(model_cfg) -> bool:\n    return bool(model_cfg.get('reasoning_parser'))","tryCatchPattern":"except ValueError as e: if 'no reasoning parser' in str(e): retry without thinking","preventionTips":["Gate thinking on model capability","Confirm --reasoning-parser at server launch","Keep a per-model capability map in the client"],"tags":["anthropic-api","reasoning","server-config"],"backgroundTag":"reasoning-parser-misconfigured","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}