risingwavelabs/risingwave · error · StreamError

Expression error: {0}

Error message

Expression error: {0}

What it means

This is the Expression variant of the stream engine ErrorKind: an ExprError from evaluating a scalar/aggregate expression inside a streaming operator is wrapped as `Expression error: {0}`. The underlying ExprError carries the real cause (type mismatch, unsupported function, constant evaluation failure, etc.).

Source

Thrown at src/stream/src/error.rs:47

/// The error type for streaming tasks.
#[derive(
    thiserror::Error,
    thiserror_ext::ReportDebug,
    thiserror_ext::Arc,
    thiserror_ext::ContextInto,
    thiserror_ext::Construct,
)]
#[thiserror_ext(newtype(name = StreamError, backtrace))]
pub enum ErrorKind {
    #[error("Storage error: {0}")]
    Storage(
        #[backtrace]
        #[from]
        StorageError,
    ),

    #[error("Expression error: {0}")]
    Expression(
        #[from]
        #[backtrace]
        ExprError,
    ),

    #[error("Executor error: {0}")]
    Executor(
        #[from]
        #[backtrace]
        StreamExecutorError,
    ),

    #[error("Actor {actor_id} exited unexpectedly: {source}")]
    UnexpectedExit {
        actor_id: ActorId,
        #[backtrace]
        source: StreamError,

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Read the inner ExprError for the failing expression and reason
  2. Fix the query: correct argument types, add NULL guards, or cast explicitly
  3. Replace unsupported functions with supported equivalents
  4. Update RisingWave if the expression should be supported (check the function support matrix)

Example fix

// before: may divide by zero at runtime
CREATE MATERIALIZED VIEW mv AS SELECT a / b FROM t;
// after
CREATE MATERIALIZED VIEW mv AS SELECT CASE WHEN b = 0 THEN NULL ELSE a / b END FROM t;
Defensive patterns

Strategy: try-catch

Validate before calling

// validate query expressions in a dry-run before creating the MV:
// EXPLAIN CREATE MATERIALIZED VIEW ... / test expressions in psql first

Try / catch

match result {
    Err(e) if matches!(e.root_cause_downcast_ref::<ExprError>(), Some(_)) => {
        log::error!("expression failed: {e}");
        // fix query or skip datum
    }
    other => other,
}

Prevention

When it happens

Trigger: Any expression evaluation failure in the stream path — e.g. a projector, filter, or aggregate calling an expression that returns Err(ExprError) — converted via `#[from] ExprError`.

Common situations: Query uses a function with unsupported argument types at runtime; NULL handling mismatches; user data triggers a division-by-zero or cast failure inside a streaming expression.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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