sgl-project/sglang · error · ValueError

min_new_tokens={min_new_tokens} is unavailable when skip_tok

Error message

min_new_tokens={min_new_tokens} is unavailable when skip_tokenizer_init=True (requires tokenizer for eos_token_id).

What it means

min_new_tokens is enforced by suppressing the EOS token, which requires knowing the tokenizer's eos_token_id. Under --skip-tokenizer-init there is no tokenizer, so raise_if_tokenizer_required rejects min_new_tokens > 0 during normalize().

Source

Thrown at python/sglang/srt/sampling/sampling_params.py:334

    to convert output token IDs to text for matching. min_new_tokens requires the
    tokenizer's eos_token_id to penalize. When skip_tokenizer_init=True, these cannot
    be used.
    """
    if tokenizer is not None:
        return

    if stop_strs:
        raise ValueError(
            f"stop={stop_strs!r} is unavailable when skip_tokenizer_init=True "
            "(requires tokenizer to decode tokens to text for matching)."
        )
    if stop_regex_strs:
        raise ValueError(
            f"stop_regex={stop_regex_strs!r} is unavailable when skip_tokenizer_init=True "
            "(requires tokenizer to decode tokens to text for matching)."
        )
    if min_new_tokens > 0:
        raise ValueError(
            f"min_new_tokens={min_new_tokens} is unavailable when skip_tokenizer_init=True "
            "(requires tokenizer for eos_token_id)."
        )

View on GitHub (pinned to 0132848349)

Solutions

  1. Remove min_new_tokens (set 0 or omit) when targeting a skip-tokenizer-init server.
  2. Or launch the server without --skip-tokenizer-init.

Example fix

# before
SamplingParams(min_new_tokens=10)  # with --skip-tokenizer-init
# after
SamplingParams(min_new_tokens=0)
Defensive patterns

Strategy: validation

Validate before calling

if skip_tokenizer_init and params.get('min_new_tokens', 0):
    params['min_new_tokens'] = 0

Type guard

def min_tokens_ok_without_tokenizer(params: dict) -> bool:
    return not params.get('min_new_tokens')

Prevention

When it happens

Trigger: Server launched with --skip-tokenizer-init while the request sets SamplingParams(min_new_tokens=1 or more), often to prevent empty completions.

Common situations: Reusing production sampling params (which set min_new_tokens) against a tokenizer-free benchmark/evaluation server that feeds input_ids directly.

Related errors


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