{"record":{"id":"8c4e24255f956874","repo":"vllm-project/vllm","slug":"text-request-request-id-stop-strings-cannot-be","errorCode":null,"errorMessage":"text request `{request_id}` stop strings cannot be empty","messagePattern":"text request `(.+?)` stop strings cannot be empty","errorType":"validation","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"rust/src/text/src/error.rs","lineNumber":18,"sourceCode":"// SPDX-License-Identifier: Apache-2.0\n// SPDX-FileCopyrightText: Copyright contributors to the vLLM project\n\nuse thiserror::Error;\nuse vllm_engine_core_client::Error as EngineCoreError;\nuse vllm_llm::Error as LlmError;\n\npub use crate::lower::logprobs::LogprobsError;\npub use crate::lower::sampling::SamplingParamsError;\npub use crate::lower::token_ids::TokenIdsError;\n\n#[derive(Debug, Error)]\npub enum Error {\n    #[error(\"tokenizer error: {0}\")]\n    Tokenizer(String),\n    #[error(\"text request `{request_id}` must contain at least one prompt token ID\")]\n    EmptyPromptTokenIds { request_id: String },\n    #[error(\"text request `{request_id}` stop strings cannot be empty\")]\n    EmptyStopString { request_id: String },\n    #[error(\n        \"this model's maximum context length is {max_model_len} tokens, \\\n         but the prompt contains {prompt_len} input tokens\"\n    )]\n    PromptTooLong { max_model_len: u32, prompt_len: u32 },\n    #[error(transparent)]\n    Logprobs(#[from] LogprobsError),\n    #[error(transparent)]\n    TokenIds(#[from] TokenIdsError),\n    #[error(transparent)]\n    SamplingParams(#[from] SamplingParamsError),\n    #[error(\n        \"`min_tokens` must be less than or equal to `max_tokens`, \\\n         got min_tokens={min_tokens}, max_tokens={max_tokens}\"\n    )]\n    MinTokensExceedsMaxTokens { min_tokens: u32, max_tokens: u32 },\n    #[error(\"`thinking_token_budget` must be a non-negative integer or -1 for unlimited.\")]","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/text/src/error.rs#L1-L36","documentation":"Error variant raised in rust/src/text/src/request.rs:238 when a request's stop strings list contains an empty string. An empty stop string would match at every position and terminate generation immediately, so it is rejected as an invalid request parameter. Like the other request-shape errors, it maps to a client-side validation error.","triggerScenarios":"POST to completions/chat with \"stop\": [\"\"] or \"stop\": [\"\\n\", \"\"] — any empty element in the stop array. Also occurs when client code joins/splits stop lists and leaves an empty residue.","commonSituations":"Building stop lists from user input without filtering empties (e.g. \"\\n, ,END\".split(',')); appending an optional stop that was never set; JSON deserialization of stop as a list where an empty default slipped in.","solutions":["Remove empty strings from the stop array before sending.","Filter in client code: stop.filter(|s| !s.is_empty()).","If you need 'stop on anything', omit the stop parameter rather than passing empty strings."],"exampleFix":"# before\n{\"prompt\": \"hi\", \"stop\": [\"\\n\", \"\"]}\n\n# after\n{\"prompt\": \"hi\", \"stop\": [\"\\n\"]}","handlingStrategy":"validation","validationCode":"stop.retain(|s| !s.is_empty());\nif stop.is_empty() { stop = None; }","typeGuard":"fn stop_list_is_valid(stop: &[String]) -> bool {\n    stop.iter().all(|s| !s.is_empty())\n}","tryCatchPattern":"match result {\n    Err(e @ vllm_text::Error::EmptyStopString { .. }) => respond_400(e),\n    other => other,\n}","preventionTips":["Filter empty strings from stop arrays in client code before sending.","When building stop lists from split(','), trim and drop empties in one pass.","Do not use an empty string to mean 'no stop' — omit the field instead."],"tags":["request-validation","stop-strings","sampling","api","rust","vllm"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}