{"record":{"id":"787a9c05b6916d21","repo":"vllm-project/vllm","slug":"generate-request-request-id-has-an-empty-promp","errorCode":null,"errorMessage":"generate request `{request_id}` has an empty prompt_token_ids","messagePattern":"generate request `(.+?)` has an empty prompt_token_ids","errorType":"exception","errorClass":"vllm_llm::Error","httpStatus":null,"severity":"error","filePath":"rust/src/llm/src/error.rs","lineNumber":11,"sourceCode":"// SPDX-License-Identifier: Apache-2.0\n// SPDX-FileCopyrightText: Copyright contributors to the vLLM project\n\nuse thiserror::Error;\n\npub type Result<T> = std::result::Result<T, Error>;\n\n/// Public error type for the Rust `llm` facade.\n#[derive(Debug, Error)]\npub enum Error {\n    #[error(\"generate request `{request_id}` has an empty prompt_token_ids\")]\n    EmptyPromptTokenIds { request_id: String },\n    #[error(\"engine-core error\")]\n    EngineCoreClient(#[from] vllm_engine_core_client::Error),\n}\n","sourceCodeStart":1,"sourceCodeEnd":16,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/llm/src/error.rs#L1-L16","documentation":"llm::Error::EmptyPromptTokenIds is the Rust LLM facade's guard against generate requests that carry an empty `prompt_token_ids` vector. An empty prompt cannot be scheduled by the engine, so the facade rejects it before reaching engine-core.","triggerScenarios":"Building a GenerateRequest with prompt_token_ids: vec![] (e.g. the tokenizer produced no tokens for empty/whitespace input, or tokenization was skipped by mistake) and passing it to the LLM generate API.","commonSituations":"Passing an empty string or empty messages list that tokenizes to zero tokens; branching that forgets to tokenize; chunked-pipeline bugs producing an empty final chunk.","solutions":["Skip or reject empty inputs before calling generate (validate prompt text/token count)","If the prompt is legitimately empty, supply at least one token (e.g. BOS) per the model's expectations","Log request_id alongside the check to find which upstream path produces empty token lists"],"exampleFix":"// before\nlet req = GenerateRequest { request_id, prompt_token_ids: tokens, .. };\nllm.generate(req).await\n\n// after\nif tokens.is_empty() {\n    return Err(anyhow!(\"prompt produced no tokens\"));\n}\nlet req = GenerateRequest { request_id, prompt_token_ids: tokens, .. };\nllm.generate(req).await","handlingStrategy":"validation","validationCode":"if request.prompt_token_ids.is_empty() {\n    return Err(anyhow::anyhow!(\"refusing to send empty prompt for {}\", request.request_id));\n}\nllm.generate(request).await","typeGuard":"fn has_tokens(r: &GenerateRequest) -> bool {\n    !r.prompt_token_ids.is_empty()\n}","tryCatchPattern":"match llm.generate(req).await {\n    Err(e @ vllm_llm::Error::EmptyPromptTokenIds { request_id }) => {\n        tracing::warn!(\"skipping empty prompt {request_id}\");\n        Ok(Default::default())\n    }\n    other => other,\n}","preventionTips":["Validate tokenized length > 0 right after tokenization, with the source text logged","Filter empty strings/messages upstream of the LLM facade","In chunked pipelines, drop empty final chunks before submission"],"tags":["validation","prompt","api-misuse","rust"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}