vllm-project/vllm · error · Error
text request `{request_id}` must contain at least one prompt
Error message
text request `{request_id}` must contain at least one prompt token ID What it means
Error variant raised in rust/src/text/src/request.rs:228 when a text request supplies prompt_token_ids that is empty. The frontend requires at least one prompt token before it can lower the request to the engine. is_request_validation_error() classifies it as an invalid user request (400-class), so the HTTP layer maps it to a client error, not a server fault.
Source
Thrown at rust/src/text/src/error.rs:16
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
use thiserror::Error;
use vllm_engine_core_client::Error as EngineCoreError;
use vllm_llm::Error as LlmError;
pub use crate::lower::logprobs::LogprobsError;
pub use crate::lower::sampling::SamplingParamsError;
pub use crate::lower::token_ids::TokenIdsError;
#[derive(Debug, Error)]
pub enum Error {
#[error("tokenizer error: {0}")]
Tokenizer(String),
#[error("text request `{request_id}` must contain at least one prompt token ID")]
EmptyPromptTokenIds { request_id: String },
#[error("text request `{request_id}` stop strings cannot be empty")]
EmptyStopString { request_id: String },
#[error(
"this model's maximum context length is {max_model_len} tokens, \
but the prompt contains {prompt_len} input tokens"
)]
PromptTooLong { max_model_len: u32, prompt_len: u32 },
#[error(transparent)]
Logprobs(#[from] LogprobsError),
#[error(transparent)]
TokenIds(#[from] TokenIdsError),
#[error(transparent)]
SamplingParams(#[from] SamplingParamsError),
#[error(
"`min_tokens` must be less than or equal to `max_tokens`, \
got min_tokens={min_tokens}, max_tokens={max_tokens}"
)]View on GitHub (pinned to c794754062)
Solutions
- Send a non-empty prompt, or at least one token ID when using prompt_token_ids.
- Guard in client code: skip or reject empty inputs before calling the API.
- If the prompt is legitimately whitespace-only, check what your tokenizer yields and send minimal content instead.
Example fix
// before
request.prompt_token_ids = Some(vec![]);
// after
request.prompt_token_ids = Some(vec![1]);
// or better: reject empty input client-side
if tokens.is_empty() { return Err("empty prompt"); } Defensive patterns
Strategy: validation
Validate before calling
if using_token_ids && prompt_token_ids.is_empty() {
return Err("prompt must contain at least one token");
} Type guard
fn prompt_is_sendable(token_ids: &[u32]) -> bool {
!token_ids.is_empty()
} Try / catch
match result {
Err(e @ vllm_text::Error::EmptyPromptTokenIds { .. }) => {
respond_400(e); // client error: bad request body, not a server fault
}
other => other,
} Prevention
- Reject empty prompts in client/gateway code before calling the API.
- When chunking inputs, drop empty segments instead of forwarding them.
- Treat this error as 400-class (is_request_validation_error() == true); do not retry it.
When it happens
Trigger: POST /v1/completions (or the internal text API) with "prompt_token_ids": [] and no text prompt; a client sending an empty string prompt that tokenizes to zero tokens; a gateway forwarding a tokenized request built from empty input.
Common situations: Programmatic clients building token-id requests from a variable that ended up empty; upstream chunking/splitting logic producing zero-length segments; prompt preprocessing that strips everything (e.g. whitespace-only prompt with a tokenizer that yields no tokens).
Related errors
- this model's maximum context length is {max_model_len} token
- text request `{request_id}` stop strings cannot be empty
- allowed_token_ids should not be empty
- token_id(s) {token_ids:?} in {parameter} are out of vocabula
- generate request `{request_id}` has an empty prompt_token_id
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/73f1298295faa930.
Report an issue: GitHub.