{"record":{"id":"8b82c76b1c7227f0","repo":"vllm-project/vllm","slug":"max-logprobs-must-be-non-negative-or-1-got","errorCode":null,"errorMessage":"max_logprobs must be non-negative or -1, got {}","messagePattern":"max_logprobs must be non-negative or -1, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/src/server/src/config.rs","lineNumber":237,"sourceCode":"    pub keep_alive_timeout: Duration,\n    /// Profiler mode that registers `/start_profile` and `/stop_profile`\n    /// routes when present.\n    pub profiler: Option<String>,\n}\n\nimpl Config {\n    /// Validate frontend configuration that can be checked before engine\n    /// startup.\n    pub fn validate(&self) -> Result<()> {\n        vllm_chat::validate_parser_overrides(&self.tool_call_parser, &self.reasoning_parser)?;\n        self.cors.validate()?;\n        if let Some(tls) = &self.tls {\n            tls.validate()?;\n        }\n        if let Some(max_logprobs) = self.max_logprobs\n            && max_logprobs < -1\n        {\n            bail!(\n                \"max_logprobs must be non-negative or -1, got {}\",\n                max_logprobs\n            );\n        }\n        if self.data_parallel_size == 0 {\n            bail!(\"data parallel size must be at least 1\");\n        }\n        if self.data_parallel_size > usize::from(u16::MAX) + 1 {\n            bail!(\n                \"data parallel size ({}) exceeds the two-byte engine identity limit\",\n                self.data_parallel_size\n            );\n        }\n        match &self.transport_mode {\n            TransportMode::HandshakeOwner { engine_count, .. } => {\n                if *engine_count != self.data_parallel_size {\n                    bail!(\n                        \"managed frontend engine count ({engine_count}) must equal data parallel size ({})\",","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/server/src/config.rs#L219-L255","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\n--max-logprobs -2\n\n# after\n--max-logprobs -1   # engine default\n# or\n--max-logprobs 20","handlingStrategy":"validation","validationCode":"fn valid_max_logprobs(v: Option<i32>) -> bool {\n    v.is_none_or(|n| n >= -1)\n}","typeGuard":"fn is_valid_max_logprobs(v: Option<i32>) -> bool {\n    v.is_none_or(|n| n >= -1)\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["configuration","logprobs","validation","rust","vllm","startup"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}