vllm-project/vllm · error · LogprobsError
requested {parameter} of {requested}, which is greater than
Error message
requested {parameter} of {requested}, which is greater than max allowed: {max_allowed} What it means
The requested logprobs count (after `-1` expansion to vocab size) exceeds the server's maximum allowed count (`sampling_limits.max_logprobs`, itself normalized and validated in rust/src/text/src/lower/logprobs.rs:48-73). Message reports the parameter name (`logprobs` or `prompt_logprobs`), the requested count, and the cap.
Source
Thrown at rust/src/text/src/lower/logprobs.rs:17
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
//! Python-compatible validation for logprobs sampling params.
//!
//! `-1` is expanded only for bounds checks. The original request values are
//! passed through to engine-core.
use thiserror::Error;
use crate::backend::SamplingLimits;
#[derive(Debug, Error)]
pub enum LogprobsError {
#[error("{parameter} must be non-negative or -1, got {value}")]
InvalidCount { parameter: &'static str, value: i32 },
#[error(
"requested {parameter} of {requested}, which is greater than max allowed: {max_allowed}"
)]
TooManyCount {
parameter: &'static str,
requested: usize,
max_allowed: usize,
},
#[error(
"requested logprob_token_ids of length {requested}, \
which is greater than max allowed: {max_allowed}"
)]
TooManyTokenIds {
requested: usize,
max_allowed: usize,
},
#[error(
"when both logprobs and logprob_token_ids are set, logprobs must equal \
len(logprob_token_ids). Got logprobs={logprobs}, len(logprob_token_ids)={num_token_ids}."View on GitHub (pinned to c794754062)
Solutions
- Lower the request's logprobs/prompt_logprobs to <= the reported max_allowed
- If you own the server, raise the max_logprobs limit at startup
Example fix
# before # server started with max_logprobs=20, request asks for all request.logprobs = -1 # after request.logprobs = 20
Defensive patterns
Strategy: validation
Validate before calling
let cap = server_max_logprobs; // from /v1/models or server config
let requested = if logprobs == Some(-1) { vocab_size } else { logprobs.unwrap_or(0) };
assert!(requested <= cap, "requested {requested} > max_logprobs {cap}"); Type guard
fn is_too_many_count(e: &Error) -> bool {
matches!(e, Error::Logprobs(LogprobsError::TooManyCount { .. }))
} Try / catch
match err {
Error::Logprobs(LogprobsError::TooManyCount { parameter, requested, max_allowed }) =>
bad_request(format!("{parameter}={requested} exceeds cap {max_allowed}")),
_ => /* ... */
} Prevention
- Fetch the server's max_logprobs once at client startup and clamp requests
- Remember -1 expands to vocab_size, which often exceeds a low cap
When it happens
Trigger: Requesting `logprobs: N` where N > max_logprobs, or `logprobs: -1` (expands to vocab_size) on a server whose max_logprobs cap is below the vocabulary size; same for prompt_logprobs.
Common situations: Using -1 'give me everything' against a server started with a low --max-logprobs; raising logprobs after a model swap to one with a larger vocab while the cap stayed fixed; client defaults copied from a server with a higher cap.
Related errors
- max_logprobs must be non-negative or -1, got {}
- max_logprobs must be non-negative or -1
- {parameter} must be non-negative or -1, got {value}
- requested logprob_token_ids of length {requested}, which is
- when both logprobs and logprob_token_ids are set, logprobs m
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/7dfcd535d436fd38.
Report an issue: GitHub.