risingwavelabs/risingwave · error · SinkError::Internal

should get start response but get {:?}

Error message

should get start response but get {:?}

What it means

`start_sink_writer_stream` establishes a bidirectional stream with a remote sink writer and waits for the first `SinkWriterStreamResponse::Start` message, which confirms the writer initialized and returns the writer handle. Any other first response yields this SinkError::Internal.

Source

Thrown at src/connector/src/sink/remote.rs:738

                    payload_schema,
                })),
            },
            |rx| async move {
                let rx = self.start_jvm_worker_thread(
                    gen_class_name!(com.risingwave.connector.JniSinkWriterHandler),
                    "runJniSinkWriterThread",
                    rx,
                );
                Ok(ReceiverStream::new(rx).map_err(RpcError::from))
            },
        )
        .await?;

        match first_rsp {
            SinkWriterStreamResponse {
                response: Some(sink_writer_stream_response::Response::Start(_)),
            } => Ok(handle),
            msg => Err(SinkError::Internal(anyhow!(
                "should get start response but get {:?}",
                msg
            ))),
        }
    }

    async fn start_sink_coordinator_stream(
        &self,
        param: SinkParam,
    ) -> Result<SinkCoordinatorStreamHandle> {
        let (handle, first_rsp) = SinkCoordinatorStreamHandle::initialize(
            SinkCoordinatorStreamRequest {
                request: Some(sink_coordinator_stream_request::Request::Start(
                    StartCoordinator {
                        param: Some(param.to_proto()),
                    },
                )),
            },

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Log the received `msg` (included in the error) to see which unexpected response arrived
  2. Verify both ends run the same SinkWriterStreamResponse protobuf definition
  3. Check the remote sink writer service startup/initialization code to ensure it sends Start first
Defensive patterns

Strategy: try-catch

Try / catch

match start_sink_writer_stream(client, param).await {
    Ok(handle) => handle,
    Err(e) if e.to_string().contains("should get start response") => {
        log::error!("unexpected first response on sink writer stream: {}", e);
        return Err(e);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: The first message received on the sink writer stream is not a Start response — e.g. the service sent a ChangeRecord/Commit/barrier response first, closed the stream, or sent an error that surfaced as a different response variant.

Common situations: Mismatched protocol versions between RisingWave and the sink service; the remote writer failed to initialize and replied with a different variant; network/proxy injecting unexpected frames.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/6bcd991e528c5977. Report an issue: GitHub.