{"record":{"id":"7dfcd535d436fd38","repo":"vllm-project/vllm","slug":"requested-parameter-of-requested-which-is-gre","errorCode":null,"errorMessage":"requested {parameter} of {requested}, which is greater than max allowed: {max_allowed}","messagePattern":"requested (.+?) of (.+?), which is greater than max allowed: (.+?)","errorType":"validation","errorClass":"LogprobsError","httpStatus":400,"severity":"error","filePath":"rust/src/text/src/lower/logprobs.rs","lineNumber":17,"sourceCode":"// SPDX-License-Identifier: Apache-2.0\n// SPDX-FileCopyrightText: Copyright contributors to the vLLM project\n\n//! Python-compatible validation for logprobs sampling params.\n//!\n//! `-1` is expanded only for bounds checks. The original request values are\n//! passed through to engine-core.\n\nuse thiserror::Error;\n\nuse crate::backend::SamplingLimits;\n\n#[derive(Debug, Error)]\npub enum LogprobsError {\n    #[error(\"{parameter} must be non-negative or -1, got {value}\")]\n    InvalidCount { parameter: &'static str, value: i32 },\n    #[error(\n        \"requested {parameter} of {requested}, which is greater than max allowed: {max_allowed}\"\n    )]\n    TooManyCount {\n        parameter: &'static str,\n        requested: usize,\n        max_allowed: usize,\n    },\n    #[error(\n        \"requested logprob_token_ids of length {requested}, \\\n         which is greater than max allowed: {max_allowed}\"\n    )]\n    TooManyTokenIds {\n        requested: usize,\n        max_allowed: usize,\n    },\n    #[error(\n        \"when both logprobs and logprob_token_ids are set, logprobs must equal \\\n         len(logprob_token_ids). Got logprobs={logprobs}, len(logprob_token_ids)={num_token_ids}.\"","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/text/src/lower/logprobs.rs#L1-L35","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\n# server started with max_logprobs=20, request asks for all\nrequest.logprobs = -1\n\n# after\nrequest.logprobs = 20","handlingStrategy":"validation","validationCode":"let cap = server_max_logprobs; // from /v1/models or server config\nlet requested = if logprobs == Some(-1) { vocab_size } else { logprobs.unwrap_or(0) };\nassert!(requested <= cap, \"requested {requested} > max_logprobs {cap}\");","typeGuard":"fn is_too_many_count(e: &Error) -> bool {\n    matches!(e, Error::Logprobs(LogprobsError::TooManyCount { .. }))\n}","tryCatchPattern":"match err {\n    Error::Logprobs(LogprobsError::TooManyCount { parameter, requested, max_allowed }) =>\n        bad_request(format!(\"{parameter}={requested} exceeds cap {max_allowed}\")),\n    _ => /* ... */\n}","preventionTips":["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"],"tags":["rust","validation","logprobs","limits","vllm"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}