{"record":{"id":"687d8e36ebcbc12c","repo":"risingwavelabs/risingwave","slug":"error-while-evaluating-expression-display","errorCode":null,"errorMessage":"error while evaluating expression `{display}`","messagePattern":"error while evaluating expression `(.+?)`","errorType":"exception","errorClass":"ExprError","httpStatus":null,"severity":"error","filePath":"src/expr/core/src/error.rs","lineNumber":130,"sourceCode":"        \"null value in column \\\"{col_name}\\\" of relation \\\"{table_name}\\\" violates not-null constraint\"\n    )]\n    NotNullViolation {\n        col_name: Box<str>,\n        table_name: Box<str>,\n    },\n\n    #[error(\"invalid state: {0}\")]\n    InvalidState(String),\n\n    /// Function error message returned by UDF.\n    /// TODO: replace with `Function`\n    #[error(\"{0}\")]\n    Custom(String),\n\n    /// Error from a function call.\n    ///\n    /// Use [`ExprError::function`] to create this error.\n    #[error(\"error while evaluating expression `{display}`\")]\n    Function {\n        display: Box<str>,\n        #[backtrace]\n        // We don't use `anyhow::Error` because we don't want to always capture the backtrace.\n        source: Box<dyn std::error::Error + Send + Sync>,\n    },\n}\n\nstatic_assertions::const_assert_eq!(std::mem::size_of::<ExprError>(), 40);\n\nimpl ExprError {\n    /// Constructs a [`ExprError::Function`] error with the given information for display.\n    pub fn function<'a>(\n        fn_name: &str,\n        args: impl IntoIterator<Item = DatumRef<'a>>,\n        source: impl Into<Box<dyn std::error::Error + Send + Sync>>,\n    ) -> Self {\n        use std::fmt::Write;","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/expr/core/src/error.rs#L112-L148","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the `source` of the error for the real root cause","Check the arguments passed to the function named in `display`","Validate/normalize input data to the function's expected domain","If a UDF, debug the UDF implementation directly"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match res { Err(ExprError::Function { display, source, .. }) => { log::error!(\"function {display} failed: {source}\"); handle(source) }, Ok(v) => v, Err(e) => return Err(e) }","preventionTips":["Check function argument domains before evaluation (e.g. non-negative for log)","Inspect the error's source chain for the root cause","Validate input data types and nullability upstream of the function call"],"tags":["rust","function-call","expression-eval","error-wrapping"],"backgroundTag":"internal-invariant-violation","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"}