{"record":{"id":"0f556886babb48e1","repo":"risingwavelabs/risingwave","slug":"invalid-backfill-state-row-count-0f5568","errorCode":null,"errorMessage":"invalid backfill state: row_count","messagePattern":"invalid backfill state: row_count","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/stream/src/executor/backfill/cdc/state_v2.rs","lineNumber":74,"sourceCode":"\n    /// Restore the backfill state from storage\n    pub async fn restore_state(&mut self, split_id: i64) -> StreamExecutorResult<CdcStateRecord> {\n        let key = Some(split_id);\n        match self\n            .state_table\n            .get_row(row::once(key.map(ScalarImpl::from)))\n            .await?\n        {\n            Some(row) => {\n                tracing::info!(\"restored cdc backfill state: {:?}\", row);\n                let state = row.into_inner().into_vec();\n                let is_finished = match state[1] {\n                    Some(ScalarImpl::Bool(val)) => val,\n                    _ => return Err(anyhow!(\"invalid backfill state: backfill_finished\").into()),\n                };\n                let row_count = match state[2] {\n                    Some(ScalarImpl::Int64(val)) => val,\n                    _ => return Err(anyhow!(\"invalid backfill state: row_count\").into()),\n                };\n                let (cdc_offset_low, cdc_offset_high) = if !self.is_legacy_state {\n                    let cdc_offset_low = match state[3] {\n                        Some(ScalarImpl::Jsonb(ref jsonb)) => {\n                            serde_json::from_value(jsonb.clone().take()).unwrap()\n                        }\n                        None => None,\n                        _ => return Err(anyhow!(\"invalid backfill state: cdc_offset_low\").into()),\n                    };\n                    let cdc_offset_high = match state[4] {\n                        Some(ScalarImpl::Jsonb(ref jsonb)) => {\n                            serde_json::from_value(jsonb.clone().take()).unwrap()\n                        }\n                        None => None,\n                        _ => return Err(anyhow!(\"invalid backfill state: cdc_offset_high\").into()),\n                    };\n                    (cdc_offset_low, cdc_offset_high)\n                } else {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/stream/src/executor/backfill/cdc/state_v2.rs#L56-L92","documentation":"Thrown by CdcBackfillStateV2::restore_state when element [2] of the persisted state row is not an Int64, so the row_count (backfill progress counter) cannot be decoded. It prevents resuming a backfill with an unreadable progress value.","triggerScenarios":"Restoring a v2 CDC backfill state where state[2] is None or a non-Int64 ScalarImpl, typically because the row was written with an older/different state layout.","commonSituations":"Version upgrades changing the state row schema; legacy state rows read by the v2 executor; state corruption from an interrupted write.","solutions":["Cancel and recreate the streaming job to rebuild backfill state from scratch","Match the executor version to the version that wrote the state row","Inspect the internal state table row to verify the row_count field type","Rebuild the MV/table from the CDC upstream if the state is unrecoverable"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let row_count_ok = matches!(state[STATE_ROW_COUNT_IDX], Some(ScalarImpl::Int64(_)));\nif !row_count_ok { /* recreate the backfill job */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid mixing executor versions in one cluster (rolling upgrade with state compatibility checks)","Let backfills finish before shutting down nodes abruptly"],"tags":["rust","streaming","cdc","state-restore"],"backgroundTag":"type-mismatch","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}