risingwavelabs/risingwave · error
Invalid row count state: {:?}
Error message
Invalid row count state: {:?} What it means
`decode_row_count` reads the persisted row-count state of an approx_percentile aggregator and expects the single state row to carry an Int64 datum at position 0. If the row exists but has a NULL first datum, the state is malformed and this error is raised.
Source
Thrown at src/stream/src/executor/approx_percentile/global_state.rs:123
1 => {
self.cache.pos_buckets.insert(bucket_id, count as i64);
}
_ => {
bail!("Invalid sign: {}", sign);
}
}
}
Ok(())
}
async fn get_row_count_state(&self) -> StreamExecutorResult<Option<OwnedRow>> {
self.count_state_table.get_row(&[Datum::None; 0]).await
}
fn decode_row_count(row_count_state: &Option<OwnedRow>) -> StreamExecutorResult<i64> {
if let Some(row) = row_count_state.as_ref() {
let Some(datum) = row.datum_at(0) else {
bail!("Invalid row count state: {:?}", row)
};
Ok(datum.into_int64())
} else {
Ok(0)
}
}
}
// Update
impl<S: StateStore> GlobalApproxPercentileState<S> {
pub fn apply_chunk(&mut self, chunk: StreamChunk) -> StreamExecutorResult<()> {
// Op is ignored here, because we only check the `delta` column inside the row.
// The sign of the `delta` column will tell us if we need to decrease or increase the
// count of the bucket.
for (_op, row) in chunk.rows() {
debug_assert_eq!(_op, Op::Insert);
self.apply_row(row)?;
}View on GitHub (pinned to 6469eb736d)
Solutions
- Drop and recreate the materialized view using approx_percentile to reset its state tables.
- Verify the RW versions that wrote and read the state match; if an upgrade is involved, re-ingest the data instead of recovering state.
- Inspect the state table for the actor via internal catalog/tools and confirm the row is NULL; if reproducible, report as a state-writer bug.
- Fall back to restoring from a backup/snapshot of the state store taken when the data was valid.
Defensive patterns
Strategy: fallback
Prevention
- Recreate approx_percentile materialized views after version upgrades.
- Ensure clean shutdowns; avoid killing compute nodes mid-checkpoint.
- Verify state table rows are non-empty and typed before relying on recovery.
When it happens
Trigger: Recovery/init of an approx_percentile global aggregator where the row-count state table contains a row whose only column is NULL — e.g. state written incompletely before a crash or by an incompatible writer version.
Common situations: Crash between inserting an empty row and filling it, RisingWave version upgrades changing state schema, or corrupted state store data.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Invalid sign: {}
- corrupt MATCH_RECOGNIZE state row: seq column must be a non-
- a stream has reached the end but some other stream has not s
- invalid state, new_count = 0 and is_new_entry is true
- invalid backfill state: row_count
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/7f42686f45db188c.
Report an issue: GitHub.