vllm-project/vllm · error · ReasoningError

tokenizer is missing reasoning delimiter token `{token}`

Error message

tokenizer is missing reasoning delimiter token `{token}`

What it means

ReasoningError::MissingToken is thrown when constructing a reasoning parser whose configured delimiter token (e.g. </think> or a similar end-of-reasoning marker) does not exist in the tokenizer's vocabulary. The parser needs the token's ID to detect reasoning boundaries, so token_to_id returning None is fatal.

Source

Thrown at rust/src/parser/src/reasoning/mod.rs:131

    /// Some model families emit reasoning sentinels as special tokens. Those
    /// parsers need `skip_special_tokens = false` while parsing is enabled.
    fn preserve_special_tokens(&self) -> bool {
        false
    }

    /// Feed one decoded text delta into the parser.
    fn push(&mut self, delta: &str) -> Result<ReasoningDelta>;

    /// Flush any buffered partial delimiter state at end of stream.
    fn finish(&mut self) -> Result<ReasoningDelta> {
        Ok(ReasoningDelta::default())
    }
}

/// Errors produced while creating or running reasoning parsers.
#[derive(Debug, Error)]
pub enum ReasoningError {
    #[error("tokenizer is missing reasoning delimiter token `{token}`")]
    MissingToken { token: String },
    #[error(
        "`{name}` only provides a unified parser; the same reasoning parser and tool parser should be specified together"
    )]
    DummyUnifiedParser { name: String },
}

#[cfg(test)]
mod tests;

View on GitHub (pinned to c794754062)

Solutions

  1. Use the reasoning parser that matches the model family (e.g. deepseek_r1 parsers with DeepSeek-R1 tokenizers)
  2. Verify the delimiter token exists: tokenizer.token_to_id("</think>") before enabling the parser
  3. If using a custom tokenizer, re-add the required special tokens to the vocab

Example fix

# before (wrong pairing)
--model meta-llama/Llama-3-8B --reasoning-parser deepseek_r1

# after
--model deepseek-ai/DeepSeek-R1 --reasoning-parser deepseek_r1
Defensive patterns

Strategy: validation

Validate before calling

// Verify delimiter token exists before enabling the parser
let tok = tokenizer.token_to_id("</think>")
    .ok_or_else(|| anyhow::anyhow!("tokenizer lacks </think>; pick a matching reasoning parser"))?;

Type guard

fn is_missing_reasoning_token(e: &ReasoningError) -> bool {
    matches!(e, ReasoningError::MissingToken { .. })
}

Try / catch

if let Err(ReasoningError::MissingToken { token }) = parser_result {
    return Err(config_err!("reasoning parser needs token {token} not in this tokenizer; disable it or switch parser"));
}

Prevention

When it happens

Trigger: Selecting a reasoning parser (e.g. deepseek-r1 style) with a tokenizer that lacks the parser's delimiter token — typically a tokenizer for a different model family, or a custom/converted tokenizer missing special tokens.

Common situations: Using --reasoning-parser with a base model tokenizer that has no <think>/</think> tokens; fine-tuned or merged tokenizers that dropped special tokens; parser name not matching the served model.

Related errors


AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14). Data as JSON: /api/errors/3fa88f26f3402a31. Report an issue: GitHub.