{"record":{"id":"b4f34df89b9e789a","repo":"vllm-project/vllm","slug":"max-logprobs-must-be-non-negative-or-1","errorCode":null,"errorMessage":"max_logprobs must be non-negative or -1","messagePattern":"max_logprobs must be non-negative or -1","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/src/server/src/render.rs","lineNumber":42,"sourceCode":"    pub host: String,\n    pub port: u16,\n    pub tool_call_parser: ParserSelection,\n    pub reasoning_parser: ParserSelection,\n    pub renderer: RendererSelection,\n    pub chat_template: Option<String>,\n    pub default_chat_template_kwargs: HashMap<String, Value>,\n    pub chat_template_content_format: ChatTemplateContentFormatOption,\n    pub max_model_len: u32,\n    pub max_logprobs: Option<i32>,\n}\n\nimpl RenderConfig {\n    /// Validate configuration before initializing renderer/tokenizer backends\n    /// or binding a listener.\n    pub fn validate(&self) -> Result<()> {\n        vllm_chat::validate_parser_overrides(&self.tool_call_parser, &self.reasoning_parser)?;\n        if self.max_logprobs.is_some_and(|value| value < -1) {\n            bail!(\"max_logprobs must be non-negative or -1\");\n        }\n        Ok(())\n    }\n}\n\npub(crate) struct RenderState {\n    pub(crate) model: String,\n    pub(crate) served_model_names: Vec<String>,\n    pub(crate) text: TextRequestProcessor,\n    pub(crate) chat: ChatRequestProcessor,\n}\n\nasync fn build_state(config: &RenderConfig) -> Result<Arc<RenderState>> {\n    let loaded = load_model_backends(\n        &config.model,\n        LoadModelBackendsOptions {\n            renderer: config.renderer,\n            language_model_only: true,","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/server/src/render.rs#L24-L60","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use max_logprobs = -1 for unlimited, or a non-negative cap.","If the value flows from the frontend Config, clamp it (v.max(-1)) before constructing RenderConfig.","Search startup logs for the origin of the RenderConfig to confirm which component set the bad value."],"exampleFix":"// before\nRenderConfig { max_logprobs: Some(-2), .. }\n\n// after\nRenderConfig { max_logprobs: Some(-1), .. }","handlingStrategy":"validation","validationCode":"if let Some(v) = render_cfg.max_logprobs {\n    assert!(v >= -1, \"max_logprobs must be non-negative or -1\");\n}","typeGuard":"fn is_valid_render_logprobs(v: Option<i32>) -> bool {\n    v.is_none_or(|n| n >= -1)\n}","tryCatchPattern":null,"preventionTips":["Normalize logprobs sentinels (-1 = unlimited) across all components once, in one helper.","Clamp shared config values with .max(-1) before building RenderConfig.","Add a unit test for RenderConfig::validate() on negative inputs."],"tags":["configuration","logprobs","render","validation","rust","vllm","startup"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}