{"record":{"id":"7f5f17fa178c1dd3","repo":"risingwavelabs/risingwave","slug":"invalid-match-recognize-define-slot-kind","errorCode":null,"errorMessage":"invalid MATCH_RECOGNIZE define slot kind: {}","messagePattern":"invalid MATCH_RECOGNIZE define slot kind: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/stream/src/executor/match_recognize/executor.rs","lineNumber":377,"sourceCode":"        )?;\n        let slots = pb\n            .slots\n            .iter()\n            .map(|s| {\n                let kind = s.kind();\n                // The binder rejects physical NEXT in DEFINE (a verdict depending on rows after\n                // the candidate needs per-candidate decidability), so no plan this frontend\n                // produces carries it — reject rather than evaluate a watermark-unsafe,\n                // arrival-order-dependent read from a skewed plan. UNSPECIFIED (also what an\n                // out-of-range wire value decodes to) fails fast rather than silently changing\n                // the predicate's meaning. Every later match on the kind relies on this.\n                if kind == DefineSlotKind::Next {\n                    return Err(StreamExecutorError::from(anyhow::anyhow!(\n                        \"physical NEXT in a MATCH_RECOGNIZE DEFINE is not supported\"\n                    )));\n                }\n                if kind == DefineSlotKind::Unspecified {\n                    return Err(StreamExecutorError::from(anyhow::anyhow!(\n                        \"invalid MATCH_RECOGNIZE define slot kind: {}\",\n                        s.kind\n                    )));\n                }\n                Ok(DefineSlot {\n                    kind,\n                    vars: s.vars.clone(),\n                    col_idx: s.col_idx as usize,\n                    offset: s.offset as usize,\n                })\n            })\n            .collect::<StreamExecutorResult<Vec<_>>>()?;\n        Ok(CompiledDefine {\n            symbol: pb.symbol.clone(),\n            condition,\n            slots,\n        })\n    }","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/stream/src/executor/match_recognize/executor.rs#L359-L395","documentation":"A MATCH_RECOGNIZE DEFINE slot's protobuf `kind` decoded to UNSPECIFIED (unset or out-of-range wire value). The executor fails fast because every later match on the kind relies on it being concrete; silently defaulting would change the predicate's meaning.","triggerScenarios":"DefineSlot::from_protobuf sees kind == DefineSlotKind::Unspecified, typically from an out-of-range i32 kind value or a kind field left unset.","commonSituations":"Version skew where a newer frontend emits a kind the backend doesn't know; corrupt plan; hand-written prost messages missing the kind.","solutions":["Align frontend/backend versions so all DefineSlotKind values are understood.","Re-create the streaming job to regenerate a valid plan.","In tests, set a valid, supported kind on each define slot."],"exampleFix":"// before\nPbDefineSlot { kind: 42 } // out of range -> UNSPECIFIED\n// after\nPbDefineSlot { kind: DefineSlotKind::Expr as i32, .. }","handlingStrategy":"validation","validationCode":"// Ensure the kind is a known, supported value before deserialization:\nlet kind = s.kind();\nif kind == DefineSlotKind::Unspecified {\n    return Err(anyhow!(\"unsupported define slot kind {}\", s.kind));\n}","typeGuard":null,"tryCatchPattern":"// Regenerate the plan when an unknown enum value is rejected:\nmatch define_from_protobuf(&pb) {\n    Err(e) if e.to_string().contains(\"invalid MATCH_RECOGNIZE define slot kind\") => regenerate_plan(),\n    r => r,\n}","preventionTips":["Keep DefineSlotKind enums synchronized across frontend/backend versions.","Use enum conversions, never raw integers, when setting kind fields.","Round-trip test all DefineSlotKind variants."],"tags":["match-recognize","protobuf","enum","plan-deserialization"],"backgroundTag":"invalid-enum-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"}