risingwavelabs/risingwave · error
internal error: entered unreachable code
Error message
internal error: entered unreachable code
What it means
When creating a UDF, the code maps the SQL function Kind to a UdfKind. Scalar and Table functions are handled; an Aggregate kind reaches unreachable!(), because aggregate UDFs are not supported for creation via this path.
Solutions
- Create the function as a SCALAR or TABLE UDF instead of AGGREGATE
- Implement the aggregation in SQL using a regular UDF plus aggregation expressions
- Check RisingWave docs/release notes for external aggregate UDF support before attempting
Example fix
-- before CREATE FUNCTION my_agg(...) RETURNS ... LANGUAGE python AS $$...$$ AGGREGATE; -- after CREATE FUNCTION my_scalar_fn(...) RETURNS ... LANGUAGE python AS $$...$$;
Defensive patterns
Strategy: validation
Validate before calling
-- Create only scalar/table UDFs; ensure no AGGREGATE kind is declared -- CREATE FUNCTION ... RETURNS ... LANGUAGE python AS $$...$$ (no AGGREGATE)
Prevention
- Never declare external UDFs as AGGREGATE
- Check UDF language runtime capabilities before CREATE FUNCTION
- Consult docs on supported UDF kinds
When it happens
Trigger: CREATE FUNCTION ... AS ... with LANGUAGE (python/javascript/rust) where the declared function kind is AGGREGATE (Kind::Aggregate), e.g. CREATE AGGREGATE-style UDF definition routed here.
Common situations: Users attempting to register custom aggregate functions as external UDFs, which the current UDF runtime does not support.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- aggregate function is not supported
- internal error: entered unreachable code
- internal error: entered unreachable code
- relative_error= does not satisfy 0.0 < relative_error < 1.0
- {0}
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/356fd71e1bf67098.
Report an issue: GitHub.
Appendix: source
Thrown at src/frontend/src/handler/create_function.rs:176
};
let base64_decoded = match ¶ms.using {
Some(CreateFunctionUsing::Base64(encoded)) => {
use base64::prelude::{BASE64_STANDARD, Engine};
let bytes = BASE64_STANDARD
.decode(encoded)
.context("invalid base64 encoding")?;
Some(bytes)
}
_ => None,
};
let create_fn =
risingwave_expr::sig::find_udf_impl(&language, runtime.as_deref(), link)?.create_fn;
let output = create_fn(CreateOptions {
kind: match kind {
Kind::Scalar(_) => UdfKind::Scalar,
Kind::Table(_) => UdfKind::Table,
Kind::Aggregate(_) => unreachable!(),
},
name: &function_name,
arg_names: &arg_names,
arg_types: &arg_types,
return_type: &return_type,
as_: params.as_.as_ref().map(|s| s.as_str()),
using_link: link,
using_base64_decoded: base64_decoded.as_deref(),
})?;
let function = PbFunction {
id: FunctionId::placeholder(),
schema_id,
database_id,
name: function_name,
kind: Some(kind),
arg_names,
arg_types: arg_types.into_iter().map(|t| t.into()).collect(),View on GitHub (pinned to 6469eb736d)