{"record":{"id":"6c775dc24e5a42ba","repo":"risingwavelabs/risingwave","slug":"unspecified-window-function-type","errorCode":null,"errorMessage":"Unspecified window function type","messagePattern":"Unspecified window function type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/expr/core/src/window_function/kind.rs","lineNumber":49,"sourceCode":"    DenseRank,\n    Lag,\n    Lead,\n\n    // Aggregate functions that are used with `OVER`.\n    #[display(\"{0}\")]\n    Aggregate(AggType),\n}\n\nimpl WindowFuncKind {\n    pub fn from_protobuf(\n        window_function_type: &risingwave_pb::expr::window_function::PbType,\n    ) -> Result<Self> {\n        use risingwave_pb::expr::agg_call::PbKind as PbAggKind;\n        use risingwave_pb::expr::window_function::{PbGeneralType, PbType};\n\n        let kind = match window_function_type {\n            PbType::General(typ) => match PbGeneralType::try_from(*typ) {\n                Ok(PbGeneralType::Unspecified) => bail!(\"Unspecified window function type\"),\n                Ok(PbGeneralType::RowNumber) => Self::RowNumber,\n                Ok(PbGeneralType::Rank) => Self::Rank,\n                Ok(PbGeneralType::DenseRank) => Self::DenseRank,\n                Ok(PbGeneralType::Lag) => Self::Lag,\n                Ok(PbGeneralType::Lead) => Self::Lead,\n                Err(_) => bail!(\"no such window function type\"),\n            },\n            #[expect(deprecated)]\n            PbType::Aggregate(kind) => Self::Aggregate(AggType::from_protobuf_flatten(\n                PbAggKind::try_from(*kind).context(\"no such aggregate function type\")?,\n                None,\n                None,\n            )?),\n            PbType::Aggregate2(agg_type) => Self::Aggregate(AggType::from_protobuf(agg_type)?),\n        };\n        Ok(kind)\n    }\n}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/expr/core/src/window_function/kind.rs#L31-L67","documentation":"WindowFuncKind::from_protobuf maps a protobuf GeneralType to a window function kind. If the general type is Unspecified, the kind is unknown and the conversion fails rather than defaulting to some function.","triggerScenarios":"Deserializing a WindowFunction whose PbType::General carries PbGeneralType::Unspecified — i.e., the general window function (RowNumber/Rank/DenseRank/Lag/Lead) was never named in the plan.","commonSituations":"Frontend bug or older proto version that left the general type unset; hand-assembled protobuf test messages missing the type field.","solutions":["Set the general window function type explicitly (RowNumber, Rank, DenseRank, Lag, Lead) in the frontend when building the plan.","Check for frontend/meta version skew where the proto type field is not populated.","Verify the generated prost enum from the .proto file matches the sender's version."],"exampleFix":"// before\nwindow_function.set_general_type(PbGeneralType::Unspecified);\n// after\nwindow_function.set_general_type(PbGeneralType::RowNumber);","handlingStrategy":"validation","validationCode":"fn window_kind_is_set(t: &PbGeneralType) -> bool { !matches!(t, PbGeneralType::Unspecified) }","typeGuard":"fn is_known_general_type(t: PbGeneralType) -> bool {\n    matches!(t, PbGeneralType::RowNumber | PbGeneralType::Rank | PbGeneralType::DenseRank | PbGeneralType::Lag | PbGeneralType::Lead)\n}","tryCatchPattern":"let kind = match WindowFuncKind::from_protobuf(&pb) {\n    Ok(k) => k,\n    Err(e) => return Err(anyhow!(\"plan contains unnamed window function: {}\", e)),\n};","preventionTips":["Populate the general type in the frontend for every general window function.","Reject window calls with no resolved name at binding time.","Add round-trip proto serialization tests."],"tags":["window-function","protobuf","enum","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"}