{"record":{"id":"b7c21946047e0498","repo":"risingwavelabs/risingwave","slug":"invalid-backfill-state-cdc-offset-low","errorCode":null,"errorMessage":"invalid backfill state: cdc_offset_low","messagePattern":"invalid backfill state: cdc_offset_low","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/stream/src/executor/backfill/cdc/state_v2.rs","lineNumber":82,"sourceCode":"        {\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 {\n                    (None, None)\n                };\n\n                Ok(CdcStateRecord {\n                    is_finished,\n                    row_count,\n                    cdc_offset_low,\n                    cdc_offset_high,","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/stream/src/executor/backfill/cdc/state_v2.rs#L64-L100","documentation":"Thrown by CdcBackfillStateV2::restore_state when element [3] of the persisted state row is neither a Jsonb-encoded CDC offset nor null, so cdc_offset_low cannot be deserialized. The code accepts Some(Jsonb) and None; any other scalar is rejected.","triggerScenarios":"Restoring a non-legacy v2 CDC backfill state where state[3] holds a scalar other than Jsonb/None, e.g. a Bytea offset from a legacy layout or a partially-written row.","commonSituations":"Mixed-version clusters where the state writer and reader disagree on offset encoding; migration bugs; corrupted state after crash during state update.","solutions":["Cancel and recreate the streaming job so the backfill state is rebuilt","Ensure all nodes run the same RisingWave version (rolling upgrades must not mix old/new state encoders for the same job)","Inspect the internal state table row to confirm the offset field type","Drop and recreate the CDC table/MV from the upstream source if state is unusable"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let low_ok = matches!(state[STATE_OFFSET_LOW_IDX], None | Some(ScalarImpl::Jsonb(_)));\nif !low_ok { /* state written by incompatible encoder; recreate */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure all compute nodes run the same RisingWave build","Complete backfill before failover/scale operations where possible"],"tags":["rust","streaming","cdc","state-restore","json"],"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"}