{"record":{"id":"490b9122cddc93b7","repo":"risingwavelabs/risingwave","slug":"get-empty-response-from-first-request","errorCode":null,"errorMessage":"get empty response from first request","messagePattern":"get empty response from first request","errorType":"exception","errorClass":"RpcError","httpStatus":null,"severity":"error","filePath":"src/rpc_client/src/lib.rs","lineNumber":291,"sourceCode":"        R: Into<REQ>,\n    >(\n        first_request: R,\n        init_stream_fn: F,\n    ) -> Result<(Self, RSP)> {\n        let (request_sender, request_receiver) = channel(DEFAULT_BUFFER_SIZE);\n\n        // Send initial request in case of the blocking receive call from creating streaming request\n        request_sender\n            .send(first_request.into())\n            .await\n            .map_err(|_err| anyhow!(\"unable to send first request of {}\", type_name::<REQ>()))?;\n\n        let mut response_stream = init_stream_fn(request_receiver).await?;\n\n        let first_response = response_stream\n            .next()\n            .await\n            .ok_or_else(|| anyhow!(\"get empty response from first request\"))??;\n\n        Ok((\n            Self {\n                request_sender: BidiStreamSender { tx: request_sender },\n                response_stream: BidiStreamReceiver {\n                    stream: response_stream.boxed().peekable(),\n                },\n            },\n            first_response,\n        ))\n    }\n\n    pub async fn next_response(&mut self) -> Result<RSP> {\n        self.response_stream.next_response().await\n    }\n\n    pub async fn send_request(&mut self, request: REQ) -> Result<()> {\n        match await_future_with_monitor_error_stream(","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/rpc_client/src/lib.rs#L273-L309","documentation":"BidiStreamHandle::initialize expects the server to answer the first request with an immediate first response, but the response stream ended before yielding anything. The stream produced None on the first poll, converted to this anyhow error.","triggerScenarios":"Calling initialize against a server whose streaming method returns an empty stream: the service accepted the request but terminated without responding (immediate error/cancellation).","commonSituations":"Server-side handler rejected the first request and closed the stream without an explicit error frame; incompatible protocol versions; service crash between stream creation and first response.","solutions":["Retry initialize; if persistent, check server logs for why the streaming handler returned without a response.","Verify client and server protobuf definitions/versions match so the handler does not bail on the first message.","Confirm the service endpoint is the correct one (not a proxy that terminates streams)."],"exampleFix":"// before\nlet first_response = response_stream.next().await.ok_or_else(|| anyhow!(\"get empty response from first request\"))??;\n// after (caller)\nlet first_response = match handle.response_stream.next_response().await {\n    Ok(rsp) => rsp,\n    Err(e) => return Err(anyhow!(\"stream closed before first response: {e}\")),\n};","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match BidiStreamHandle::initialize(&client, first_req).await {\n    Err(e) if e.to_string().contains(\"get empty response from first request\") => {\n        // server closed stream without answering: retry after delay, then fail with server-log hint\n    }\n    other => other?,\n}","preventionTips":["Keep client/server protobuf and version compatibility checked in CI.","Alert on server handlers that terminate streams without error frames.","Retry initialization a bounded number of times before surfacing to operators."],"tags":["rpc","streaming","grpc","empty-response"],"backgroundTag":"unexpected-response-shape","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}