risingwavelabs/risingwave · error · BatchError

Array error: {0}

Error message

Array error: {0}

What it means

BatchError::Array converts an ArrayError into the batch error type with #[from], displaying as "Array error: {0}". It appears when batch execution performs an array/tensor operation that fails — e.g. type mismatch, invalid casting, or out-of-bounds access on the underlying columnar arrays.

Source

Thrown at src/batch/src/error.rs:50

use tokio_postgres::Error as PostgresError;
use tonic::Status;

pub type Result<T> = std::result::Result<T, BatchError>;
/// Batch result with shared error.
pub type SharedResult<T> = std::result::Result<T, Arc<BatchError>>;

pub trait Error = std::error::Error + Send + Sync + 'static;

#[derive(Error, Debug, Construct)]
pub enum BatchError {
    #[error("Storage error: {0}")]
    Storage(
        #[backtrace]
        #[from]
        StorageError,
    ),

    #[error("Array error: {0}")]
    Array(
        #[from]
        #[backtrace]
        ArrayError,
    ),

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

    #[error("Serialize/deserialize error: {0}")]
    Serde(
        #[source]
        #[backtrace]
        BoxedError,

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Read the wrapped ArrayError message to identify which column/type operation failed.
  2. Fix the query: cast literals/values explicitly to match the column type (e.g. use explicit ::casts).
  3. Validate array literals and nesting depth match the column schema.
  4. If triggered by a valid query, file a bug with the SQL and the inner ArrayError.

Example fix

// before: literal type does not match column
INSERT INTO t(arr) VALUES (ARRAY[1, 'a']);
// after: explicit, consistent element type
INSERT INTO t(arr) VALUES (ARRAY[1, 2]::INT[]);
Defensive patterns

Strategy: validation

Validate before calling

// SQL: ensure literal types match column schema before executing
-- e.g. SELECT ARRAY[1,2]::INT[] = arr FROM t;

Try / catch

match result {
    Err(BatchError::Array(arr_err)) => {
        // surface arr_err to the user with column/type context
    }
    other => other,
}

Prevention

When it happens

Trigger: A batch executor or expression evaluates array data via `?` on a fallible array operation (cast, append, literal construction, element access) and ArrayError is auto-converted.

Common situations: Queries with mismatched or unrepresentable literal types for a column; invalid casts on array columns; bugs in expression evaluation over nested/array types.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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