vllm-project/vllm · error

max_logprobs must be non-negative or -1

Error message

max_logprobs must be non-negative or -1

What it means

Thrown by RenderConfig::validate() when its max_logprobs field is Some(v) with v < -1. This is the render-service twin of the frontend Config check: the renderer/tokenizer backend caps logprobs, where -1 means 'no cap' and only -1 is allowed as a negative. Validation runs before initializing renderer/tokenizer backends or binding a listener.

Source

Thrown at rust/src/server/src/render.rs:42

    pub host: String,
    pub port: u16,
    pub tool_call_parser: ParserSelection,
    pub reasoning_parser: ParserSelection,
    pub renderer: RendererSelection,
    pub chat_template: Option<String>,
    pub default_chat_template_kwargs: HashMap<String, Value>,
    pub chat_template_content_format: ChatTemplateContentFormatOption,
    pub max_model_len: u32,
    pub max_logprobs: Option<i32>,
}

impl RenderConfig {
    /// Validate configuration before initializing renderer/tokenizer backends
    /// or binding a listener.
    pub fn validate(&self) -> Result<()> {
        vllm_chat::validate_parser_overrides(&self.tool_call_parser, &self.reasoning_parser)?;
        if self.max_logprobs.is_some_and(|value| value < -1) {
            bail!("max_logprobs must be non-negative or -1");
        }
        Ok(())
    }
}

pub(crate) struct RenderState {
    pub(crate) model: String,
    pub(crate) served_model_names: Vec<String>,
    pub(crate) text: TextRequestProcessor,
    pub(crate) chat: ChatRequestProcessor,
}

async fn build_state(config: &RenderConfig) -> Result<Arc<RenderState>> {
    let loaded = load_model_backends(
        &config.model,
        LoadModelBackendsOptions {
            renderer: config.renderer,
            language_model_only: true,

View on GitHub (pinned to c794754062)

Solutions

  1. Use max_logprobs = -1 for unlimited, or a non-negative cap.
  2. If the value flows from the frontend Config, clamp it (v.max(-1)) before constructing RenderConfig.
  3. Search startup logs for the origin of the RenderConfig to confirm which component set the bad value.

Example fix

// before
RenderConfig { max_logprobs: Some(-2), .. }

// after
RenderConfig { max_logprobs: Some(-1), .. }
Defensive patterns

Strategy: validation

Validate before calling

if let Some(v) = render_cfg.max_logprobs {
    assert!(v >= -1, "max_logprobs must be non-negative or -1");
}

Type guard

fn is_valid_render_logprobs(v: Option<i32>) -> bool {
    v.is_none_or(|n| n >= -1)
}

Prevention

When it happens

Trigger: Starting the standalone render service (or any consumer of RenderConfig) with max_logprobs set to -2 or lower. Note this message has no value placeholder — it only says the constraint.

Common situations: Sharing one config template between the API server and the render service where the API server tolerated a different sentinel; scripts defaulting to a negative 'unlimited' convention other than -1.

Related errors


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