risingwavelabs/risingwave · error · RpcError

should get Commit response but get {:?}

Error message

should get Commit response but get {:?}

What it means

commit in ConnectorClient awaited the next SinkWriterStreamResponse and got something other than a Commit response. The catch-all arm formats the actual message with debug formatting into RpcError::Internal.

Source

Thrown at src/rpc_client/src/connector_client.rs:124

            SinkCoordinatorStreamResponse {
                response:
                    Some(sink_coordinator_stream_response::Response::Commit(
                        sink_coordinator_stream_response::CommitResponse {
                            epoch: response_epoch,
                        },
                    )),
            } => {
                if epoch == response_epoch {
                    Ok(())
                } else {
                    Err(RpcError::Internal(anyhow!(
                        "get different response epoch to commit epoch: {} {}",
                        epoch,
                        response_epoch
                    )))
                }
            }
            msg => Err(RpcError::Internal(anyhow!(
                "should get Commit response but get {:?}",
                msg
            ))),
        }
    }
}

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Read the printed variant: if it is Sync, use the SyncSink path (next_commit_response) instead of commit; if Batch, skip and continue waiting.
  2. Check connector service logs for sink failures that turn expected commits into error responses.
  3. Recreate the sink writer stream and retry the epoch commit.

Example fix

// before
msg => Err(RpcError::Internal(anyhow!("should get Commit response but get {:?}", msg))),
// after: handle Batch and error variants explicitly
SinkWriterStreamResponse { response: Some(Response::Batch(_)) } => continue,
SinkWriterStreamResponse { response: Some(Response::Error(e)) } => Err(e.into()),
msg => Err(RpcError::Internal(anyhow!("should get Commit response but get {:?}", msg))),
Defensive patterns

Strategy: try-catch

Try / catch

match client.commit(epoch).await {
    Err(e) if e.to_string().contains("should get Commit response") => {
        // variant mismatch: pick the matching API (Sync vs Commit) or recreate the stream
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling commit when the stream returns a Sync/Batch response where Commit was expected, or the stream yields an error/no message variant.

Common situations: Calling commit on a sink writer whose protocol stage expects Sync first (SyncSink writers); connector service returning error responses due to sink failure; version-skewed connector endpoint.

Related errors


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