{"record":{"id":"a5e1183711778f6c","repo":"vllm-project/vllm","slug":"text-request-stream-request-id-closed-before-t","errorCode":null,"errorMessage":"text request stream `{request_id}` closed before terminal output","messagePattern":"text request stream `(.+?)` closed before terminal output","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"rust/src/text/src/error.rs","lineNumber":40,"sourceCode":"         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.\")]\n    InvalidThinkingTokenBudget,\n    #[error(\"invalid repetition detection params: {message}\")]\n    InvalidRepetitionDetection { message: String },\n    #[error(\"text request stream `{request_id}` closed before terminal output\")]\n    StreamClosedBeforeTerminalOutput { request_id: String },\n    #[error(transparent)]\n    Llm(#[from] LlmError),\n    #[error(transparent)]\n    EngineCore(#[from] EngineCoreError),\n}\n\npub type Result<T> = std::result::Result<T, Error>;\n\nimpl Error {\n    /// Whether this error represents invalid user request parameters.\n    pub fn is_request_validation_error(&self) -> bool {\n        match self {\n            Self::PromptTooLong { .. }\n            | Self::EmptyPromptTokenIds { .. }\n            | Self::EmptyStopString { .. }\n            | Self::Logprobs(_)\n            | Self::TokenIds(_)","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/text/src/error.rs#L22-L58","documentation":"The decoded output stream for a request ended without ever emitting a terminal event (finish reason / usage). Raised at the end of the decode loop in rust/src/text/src/output/decoded.rs:301 and as a defensive branch in output/mod.rs:104 (there noted as effectively unreachable because the underlying engine stream reports its own error on unexpected close). It means the request produced partial or no output and then the stream closed cleanly without a finish marker.","triggerScenarios":"Engine-core ends the output stream for a request without a finish event: engine-side cancellation/abort that closes the stream quietly, a detokenizer bug that never forwards the terminal event, or a client dropping the request mid-stream causing the collector to observe end-of-stream first.","commonSituations":"Long-running generations interrupted by server shutdown or preemption; bugs during upgrades of the Rust frontend where a new event type is not recognized as terminal; stress tests that abort requests concurrently.","solutions":["Retry the request; this reflects an abnormal termination, not bad parameters","Check engine-core logs for the same request_id to find the root cause (abort, crash, or dropped terminal event)","If reproducible, capture the request_id and report it — a clean stream close without terminal output indicates a frontend/engine contract bug"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"fn is_stream_closed(e: &Error) -> bool {\n    matches!(e, Error::StreamClosedBeforeTerminalOutput { .. })\n}","tryCatchPattern":"match collect_output(stream).await {\n    Err(Error::StreamClosedBeforeTerminalOutput { request_id }) => {\n        tracing::warn!(%request_id, \"stream closed before terminal output; retrying\");\n        retry_with_backoff().await\n    }\n    other => other,\n}","preventionTips":["Treat this as transient: retry with backoff and a fresh request_id","Log the request_id alongside engine-core logs to correlate the silent close","Avoid aborting requests mid-stream from orchestrators unless you also tolerate partial results"],"tags":["rust","streaming","engine-core","vllm"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}