risingwavelabs/risingwave · error · ExprError

error while evaluating expression `{display}`

Error message

error while evaluating expression `{display}`

What it means

ExprError::Function wraps an error from a function (builtin or UDF) call during expression evaluation, showing the function's display name plus the underlying source error. It is created via ExprError::function. The backtrace is captured lazily since the source is a boxed dyn Error.

Source

Thrown at src/expr/core/src/error.rs:130

        "null value in column \"{col_name}\" of relation \"{table_name}\" violates not-null constraint"
    )]
    NotNullViolation {
        col_name: Box<str>,
        table_name: Box<str>,
    },

    #[error("invalid state: {0}")]
    InvalidState(String),

    /// Function error message returned by UDF.
    /// TODO: replace with `Function`
    #[error("{0}")]
    Custom(String),

    /// Error from a function call.
    ///
    /// Use [`ExprError::function`] to create this error.
    #[error("error while evaluating expression `{display}`")]
    Function {
        display: Box<str>,
        #[backtrace]
        // We don't use `anyhow::Error` because we don't want to always capture the backtrace.
        source: Box<dyn std::error::Error + Send + Sync>,
    },
}

static_assertions::const_assert_eq!(std::mem::size_of::<ExprError>(), 40);

impl ExprError {
    /// Constructs a [`ExprError::Function`] error with the given information for display.
    pub fn function<'a>(
        fn_name: &str,
        args: impl IntoIterator<Item = DatumRef<'a>>,
        source: impl Into<Box<dyn std::error::Error + Send + Sync>>,
    ) -> Self {
        use std::fmt::Write;

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Inspect the `source` of the error for the real root cause
  2. Check the arguments passed to the function named in `display`
  3. Validate/normalize input data to the function's expected domain
  4. If a UDF, debug the UDF implementation directly
Defensive patterns

Strategy: try-catch

Try / catch

match res { Err(ExprError::Function { display, source, .. }) => { log::error!("function {display} failed: {source}"); handle(source) }, Ok(v) => v, Err(e) => return Err(e) }

Prevention

When it happens

Trigger: A builtin function's implementation returns Err during eval and the caller wraps it with ExprError::function(display, err); a UDF evaluation fails and is propagated with the function's display name.

Common situations: Function-specific failures such as invalid arguments caught at eval time, regex/parse failures inside functions, UDF runtime errors surfaced with the function name for context.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/687d8e36ebcbc12c. Report an issue: GitHub.