vllm-project/vllm · error
max_logprobs must be non-negative or -1, got {}
Error message
max_logprobs must be non-negative or -1, got {} What it means
Thrown by Config::validate() (the frontend server Config, not RenderConfig) when the optional --max-logprobs value is less than -1. -1 is the sentinel for 'engine default/unbounded'; 0 and positive values are valid. Validation happens before engine startup, after parser-override, CORS, and TLS checks.
Source
Thrown at rust/src/server/src/config.rs:237
pub keep_alive_timeout: Duration,
/// Profiler mode that registers `/start_profile` and `/stop_profile`
/// routes when present.
pub profiler: Option<String>,
}
impl Config {
/// Validate frontend configuration that can be checked before engine
/// startup.
pub fn validate(&self) -> Result<()> {
vllm_chat::validate_parser_overrides(&self.tool_call_parser, &self.reasoning_parser)?;
self.cors.validate()?;
if let Some(tls) = &self.tls {
tls.validate()?;
}
if let Some(max_logprobs) = self.max_logprobs
&& max_logprobs < -1
{
bail!(
"max_logprobs must be non-negative or -1, got {}",
max_logprobs
);
}
if self.data_parallel_size == 0 {
bail!("data parallel size must be at least 1");
}
if self.data_parallel_size > usize::from(u16::MAX) + 1 {
bail!(
"data parallel size ({}) exceeds the two-byte engine identity limit",
self.data_parallel_size
);
}
match &self.transport_mode {
TransportMode::HandshakeOwner { engine_count, .. } => {
if *engine_count != self.data_parallel_size {
bail!(
"managed frontend engine count ({engine_count}) must equal data parallel size ({})",View on GitHub (pinned to c794754062)
Solutions
- Use a non-negative integer to cap logprobs (e.g. --max-logprobs 20).
- Use exactly -1 to defer to the engine default; no other negative is accepted.
- If the value comes from an env var or template, print it before launch to catch arithmetic mistakes.
Example fix
# before --max-logprobs -2 # after --max-logprobs -1 # engine default # or --max-logprobs 20
Defensive patterns
Strategy: validation
Validate before calling
fn valid_max_logprobs(v: Option<i32>) -> bool {
v.is_none_or(|n| n >= -1)
} Type guard
fn is_valid_max_logprobs(v: Option<i32>) -> bool {
v.is_none_or(|n| n >= -1)
} Prevention
- Only -1 means 'engine default'; clamp computed values with .max(-1).
- Unit-test any script that derives --max-logprobs arithmetically.
- Prefer omitting the flag when you want the default.
When it happens
Trigger: Starting the server with --max-logprobs -2 or any smaller negative number. A Some(max_logprobs) value below -1 trips the let-chain guard and bails with the offending number in the message.
Common situations: Scripts that pass -1 for 'unlimited' but compute the value (e.g. `--max-logprobs $((0 - 2))`), or users assuming any negative means unlimited. Migrating from Python vLLM where the sentinel semantics differed.
Related errors
- max_logprobs must be non-negative or -1
- data parallel size must be at least 1
- engine start index does not fit usize
- invalid --allowed-methods value {method:?}: {e}
- invalid --allowed-headers value {header:?}: {e}
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/8b82c76b1c7227f0.
Report an issue: GitHub.