sgl-project/sglang · error · ValueError

Anthropic thinking is not supported for reasoning parser '{s

Error message

Anthropic thinking is not supported for reasoning parser '{self.reasoning_parser}'

What it means

Anthropic thinking was enabled, and although a reasoning parser is configured, the read-side toggle is unsupported: either no toggle template parameter exists (toggle_param is None) or the parser config lacks a default_enabled value. SGLang cannot map 'thinking enabled' onto a chat-template switch for this parser.

Source

Thrown at python/sglang/srt/entrypoints/openai/serving_chat.py:2421

            return

        toggle_param = self._get_reasoning_toggle_param()
        # The read side (``_get_reasoning_from_request``) returns False
        # whenever ``config.toggle_param is None`` OR
        # ``config.default_enabled is None``. The write side must mirror
        # both conditions: if ``default_enabled`` is unset we cannot
        # actually honor an ``enabled=True`` request even when the toggle
        # name itself is resolvable, so writing the kwarg would set up the
        # template to emit reasoning tokens while the parser ignores them
        # (literal ``<think>`` markers leak into the assistant text).
        config = self.template_manager.reasoning_config
        read_side_supported = toggle_param is not None and (
            config is None or config.default_enabled is not None
        )
        if not read_side_supported:
            if not enabled:
                return
            raise ValueError(
                f"Anthropic thinking is not supported for reasoning parser "
                f"'{self.reasoning_parser}'"
            )

        chat_template_kwargs = dict(request.chat_template_kwargs or {})
        chat_template_kwargs[toggle_param] = enabled
        request.chat_template_kwargs = chat_template_kwargs

    def _get_reasoning_from_request(self, request: ChatCompletionRequest) -> bool:
        """Determine whether reasoning mode should be enabled for this request.

        NOTE: This is predefined based on model's chat template
        """
        if not self.reasoning_parser:
            return False

        if self.reasoning_parser == "minimax-m3":
            # M3 template prefills <mm:think> for thinking_mode=enabled, so it never

View on GitHub (pinned to 0132848349)

Solutions

  1. Remove the thinking parameter from the request and rely on the model's default reasoning behavior
  2. Use a reasoning parser with toggle support (one with a configured toggle parameter/default_enabled)
  3. Upgrade SGLang if the parser recently gained toggle support

Example fix

# before
request.thinking = {"type": "enabled", "budget_tokens": 2048}  # non-toggleable parser
# after
request.thinking = None  # use model default
Defensive patterns

Strategy: validation

Validate before calling

if thinking_enabled and parser not in TOGGLEABLE_PARSERS: thinking = None

Type guard

def supports_thinking_toggle(parser_cfg) -> bool:
    return parser_cfg is not None and parser_cfg.get('default_enabled') is not None

Try / catch

except ValueError as e: if 'not supported' in str(e): resend without thinking

Prevention

When it happens

Trigger: Enabling thinking on a reasoning parser that has no template-level on/off parameter (e.g. a parser that is neither always-on nor toggleable), where config exists but default_enabled is None.

Common situations: Using a newer/less-common reasoning parser without toggle support; assuming all --reasoning-parser values support the Anthropic thinking flag.

Related errors


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