{"record":{"id":"d985c49f7e26bf9f","repo":"vllm-project/vllm","slug":"request-request-id-is-already-in-flight","errorCode":null,"errorMessage":"request `{request_id}` is already in flight","messagePattern":"request `(.+?)` is already in flight","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"rust/src/engine-core-client/src/error.rs","lineNumber":69,"sourceCode":"    UnexpectedHandshakeMessage { message: String },\n    #[error(\"unexpected non-control output on coordinator path: {message}\")]\n    UnexpectedCoordinatorOutput { message: String },\n    #[error(\"unexpected output on main dispatcher path: {message}\")]\n    UnexpectedDispatcherOutput { message: String },\n    #[error(\"coordinator requires a Python-compatible two-byte engine id, got {engine_id:?}\")]\n    UnsupportedCoordinatorEngineId { engine_id: Vec<u8> },\n    #[error(\"unsupported auxiliary frame(s): expected 1 frame, got {frame_count}\")]\n    UnsupportedAuxFrames { frame_count: usize },\n    #[error(\"external coordinator mode is not implemented yet\")]\n    UnsupportedExternalCoordinator,\n    #[error(\"unsupported field `{field}` in {context}\")]\n    UnsupportedField {\n        context: &'static str,\n        field: &'static str,\n    },\n    #[error(\"engine control channel closed unexpectedly: {message}\")]\n    ControlClosed { message: String },\n    #[error(\"request `{request_id}` is already in flight\")]\n    DuplicateRequestId { request_id: String },\n    #[error(\n        \"data parallel rank {rank} is not connected to this frontend; connected ranks: {connected_ranks:?}\"\n    )]\n    InvalidDataParallelRank {\n        rank: u32,\n        connected_ranks: Vec<u32>,\n    },\n    #[error(\"engine-core output dispatcher closed: {message}\")]\n    DispatcherClosed { message: String },\n    #[error(\"engine-core client is closed: {message}\")]\n    ClientClosed { message: String },\n    #[error(\"request output stream for `{request_id}` closed unexpectedly\")]\n    RequestStreamClosed { request_id: String },\n    #[error(\"utility call `{method}` failed (call_id={call_id}): {message}\")]\n    UtilityCallFailed {\n        method: String,\n        call_id: UtilityCallId,","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/engine-core-client/src/error.rs#L51-L87","documentation":"EngineCoreError::DuplicateRequestId is returned when a generate request is submitted with a `request_id` that is already tracked as in-flight by the client. The client keys active request output streams by request_id, so a duplicate would collide with the existing stream.","triggerScenarios":"Calling client.generate() (or the LLM facade) twice with the same explicit request_id before the first request finishes; reusing counters or static IDs across retries instead of fresh unique IDs.","commonSituations":"Retry logic that resubmits with the same request_id while the original is still streaming; sharing an ID generator that resets; copying example code that hardcodes request_id = \"0\" or \"1\" in a loop.","solutions":["Use a fresh unique ID per request (uuid::Uuid::new_v4() or a monotonically increasing counter that never repeats)","Await or abort the in-flight request with the same ID before resubmitting it","If retrying after a failure, ensure the failed request was fully removed from the in-flight map (abort it) before reusing its ID"],"exampleFix":"// before\nlet rid = \"req-1\".to_string();\nfor _ in 0..3 { client.generate(rid.clone(), req.clone()).await; }\n\n// after\nfor _ in 0..3 {\n    let rid = uuid::Uuid::new_v4().to_string();\n    client.generate(rid, req.clone()).await;\n}","handlingStrategy":"validation","validationCode":"// Before submitting, ensure the ID is not already in flight\nif client.in_flight(&request_id).await {\n    return Err(anyhow::anyhow!(\"request {request_id} still in flight; pick a new id\"));\n}\nclient.generate(request_id, req).await","typeGuard":null,"tryCatchPattern":"if let Err(vllm_engine_core_client::Error::DuplicateRequestId { request_id }) = res {\n    tracing::warn!(\"{request_id} reused; aborting old and retrying with fresh id\");\n    client.abort(request_id.clone()).await.ok();\n    res = client.generate(new_id(), req).await;\n}","preventionTips":["Always generate request IDs from a UUID v4 generator instead of user-supplied or hardcoded strings","When retrying a failed request, allocate a new request_id rather than reusing the original","Abort the previous request before deliberately reusing its ID"],"tags":["request-id","duplicate","api-misuse","rust"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}