{"record":{"id":"d73c61a068ddab02","repo":"sgl-project/sglang","slug":"reasoning-parser-self-reasoning-parser-is-alwa","errorCode":null,"errorMessage":"Reasoning parser '{self.reasoning_parser}' is always-on and cannot be disabled via Anthropic thinking","messagePattern":"Reasoning parser '(.+?)' is always-on and cannot be disabled via Anthropic thinking","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"python/sglang/srt/entrypoints/openai/serving_chat.py","lineNumber":2399,"sourceCode":"            # 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\"\n        )\n        if is_mistral:\n            request.reasoning_effort = \"medium\" if enabled else \"none\"\n            return\n\n        is_always_on = (config is not None and config.special_case == \"always\") or (\n            config is None and self._reasoning_default_mode() == \"always\"\n        )\n        if is_always_on:\n            if not enabled:\n                raise ValueError(\n                    f\"Reasoning parser '{self.reasoning_parser}' is always-on \"\n                    f\"and cannot be disabled via Anthropic thinking\"\n                )\n            return\n\n        toggle_param = self._get_reasoning_toggle_param()\n        # The read side (``_get_reasoning_from_request``) returns False\n        # whenever ``config.toggle_param is None`` OR\n        # ``config.default_enabled is None``. The write side must mirror\n        # both conditions: if ``default_enabled`` is unset we cannot\n        # actually honor an ``enabled=True`` request even when the toggle\n        # name itself is resolvable, so writing the kwarg would set up the\n        # template to emit reasoning tokens while the parser ignores them\n        # (literal ``<think>`` markers leak into the assistant text).\n        config = self.template_manager.reasoning_config\n        read_side_supported = toggle_param is not None and (\n            config is None or config.default_enabled is not None\n        )","sourceCodeStart":2381,"sourceCodeEnd":2417,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/entrypoints/openai/serving_chat.py#L2381-L2417","documentation":"The request tried to disable thinking (Anthropic thinking enabled=False) for a reasoning parser that SGLang classifies as always-on (e.g. its config special_case == \"always\" or the default mode resolves to \"always\"). Such models always produce reasoning and cannot be turned off, so disabling raises instead of silently failing.","triggerScenarios":"Anthropic-style request with thinking disabled against an always-on reasoning model (certain hybrid/always-thinking model configs).","commonSituations":"Clients that send thinking={\"type\":\"disabled\"} by default for cost control; switching a client from a toggleable reasoner to an always-on one.","solutions":["Omit the thinking field entirely for always-on reasoning models","Switch to a model whose reasoning is toggleable if disabling is a hard requirement","Check the parser config's special_case/default mode to know which models are always-on"],"exampleFix":"# before\nrequest.thinking = {\"type\": \"disabled\"}  # always-on parser\n# after\nrequest.thinking = None","handlingStrategy":"validation","validationCode":"if thinking is not None and thinking.get('type') == 'disabled' and model_is_always_on_reasoner:\n    thinking = None","typeGuard":"def is_always_on(parser_name) -> bool: return parser_name in ALWAYS_ON_PARSERS  # e.g. per docs","tryCatchPattern":"except ValueError as e: if 'always-on' in str(e): drop thinking param and resend","preventionTips":["Don't send thinking disabled by default","Check parser special_case before toggling","Cache per-model reasoning mode"],"tags":["anthropic-api","reasoning","toggle"],"backgroundTag":"reasoning-cannot-be-disabled","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}