risingwavelabs/risingwave · error · anyhow::Error

should get AlignInitialEpochResponse but get {:?}

Error message

should get AlignInitialEpochResponse but get {:?}

What it means

SinkCoordinateClient::align_initial_epoch sends an AlignInitialEpochRequest and expects an AlignInitialEpochResponse carrying the aligned epoch. Any other response triggers this error, meaning epoch alignment with the sink coordinator did not complete as expected.

Source

Thrown at src/rpc_client/src/sink_coordinate_client.rs:163

            CoordinateResponse {
                msg: Some(coordinate_response::Msg::Stopped(_)),
            } => Ok(()),
            msg => Err(anyhow!("should get Stopped but get {:?}", msg)),
        }
    }

    pub async fn align_initial_epoch(&mut self, initial_epoch: u64) -> anyhow::Result<u64> {
        self.send_request(CoordinateRequest {
            msg: Some(coordinate_request::Msg::AlignInitialEpochRequest(
                initial_epoch,
            )),
        })
        .await?;
        match self.next_response().await? {
            CoordinateResponse {
                msg: Some(coordinate_response::Msg::AlignInitialEpochResponse(epoch)),
            } => Ok(epoch),
            msg => Err(anyhow!(
                "should get AlignInitialEpochResponse but get {:?}",
                msg
            )),
        }
    }
}

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Read the debug-printed `msg` to see the unexpected response
  2. Recreate the coordination stream and redo initialization (align_initial_epoch) from scratch
  3. Check coordinator logs and align component versions
Defensive patterns

Strategy: retry

Try / catch

// Rust
let epoch = loop {
    match client.align_initial_epoch(initial_epoch).await {
        Ok(e) => break e,
        Err(e) if e.to_string().contains("AlignInitialEpochResponse") && retries < 3 => {
            retries += 1;
            client = SinkCoordinateClient::start(...).await?;
        }
        Err(e) => return Err(e),
    }
};

Prevention

When it happens

Trigger: Calling align_initial_epoch during sink initialization when the coordinator returns a different CoordinateResponse variant — stale buffered response, coordinator restart, or protocol version skew.

Common situations: Sink startup racing with coordinator restart; stream desync from earlier failed calls; compute node/meta version mismatch after upgrade.

Related errors


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