{"record":{"id":"0f091ff39f9862f9","repo":"risingwavelabs/risingwave","slug":"clean-watermark-column-index-is-not-included-in","errorCode":null,"errorMessage":"clean watermark column index {} is not included in table value indices {:?}","messagePattern":"clean watermark column index (.+?) is not included in table value indices (.+?)","errorType":"exception","errorClass":"StreamExecutorError","httpStatus":null,"severity":"error","filePath":"src/stream/src/common/table/state_table.rs","lineNumber":2225,"sourceCode":"                \"Watermark serde should have at least one order type\"\n            ))\n        })?;\n\n        let direction = if order_type.is_ascending() {\n            WatermarkDirection::Ascending\n        } else {\n            WatermarkDirection::Descending\n        };\n        let clean_watermark_index_in_pk = self\n            .pk_indices\n            .iter()\n            .position(|&i| i == clean_watermark_index);\n        let clean_watermark_index_in_value = match &self.value_indices {\n            Some(value_indices) => value_indices\n                .iter()\n                .position(|idx| *idx == clean_watermark_index)\n                .ok_or_else(|| {\n                    StreamExecutorError::from(anyhow!(\n                        \"clean watermark column index {} is not included in table value indices {:?}\",\n                        clean_watermark_index,\n                        value_indices\n                    ))\n                })?,\n            None => clean_watermark_index,\n        };\n\n        let stream = self\n            .iter_with_prefix_inner::</* REVERSE */ false, Bytes>(pk_prefix, sub_range, prefetch_options)\n            .await?\n            .try_filter_map(move |(pk, row)| {\n                let should_filter =  match watermark_type {\n                    WatermarkSerdeType::PkPrefix => unreachable!(),\n                    WatermarkSerdeType::NonPkPrefix => {\n                        let table_key = TableKey(pk);\n                        let (vnode, key) = table_key.split_vnode();\n                        let pk_cols = self.pk_serde","sourceCodeStart":2207,"sourceCodeEnd":2243,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/stream/src/common/table/state_table.rs#L2207-L2243","documentation":"When looking up where the clean watermark column lives inside the state table's value_indices mapping, the index was not found among the value column indices. The state table maintains a remapping of logical column indexes to stored value positions; a clean watermark column absent from that mapping means the table layout and the watermark column configuration are inconsistent.","triggerScenarios":"Calling the watermark update path with `Some(value_indices)` set where none of the entries equals `clean_watermark_index` — i.e. the clean watermark column is a key column or was dropped from the value layout.","commonSituations":"Table schema changed (column added/removed) without rebuilding the state table; watermark column configured as part of the primary key while the code expects it in the value columns; stale state table after a materialized view definition change.","solutions":["Ensure the clean watermark column is part of the table's value columns, not only the primary key","Recreate the table/mv so value_indices includes the watermark column index","Check the table catalog and column index computation for off-by-one or stale indices after schema change","Rebuild the state table from the current schema instead of a cached layout"],"exampleFix":"// before: value_indices omits the watermark column\nvalue_indices: Some(vec![0, 1]),\n// after: include the clean watermark index (2)\nvalue_indices: Some(vec![0, 1, 2]),","handlingStrategy":"validation","validationCode":"fn watermark_in_value_indices(idx: usize, value_indices: &Option<Vec<usize>>) -> bool {\n    match value_indices {\n        Some(v) => v.contains(&idx),\n        None => true,\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the clean watermark column in the table's value columns","Recompute value_indices whenever the table schema changes","Add an init-time assertion that all key columns appear in the layout"],"tags":["rust","streaming","state-table","column-index"],"backgroundTag":"invalid-argument-value","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"}