{"record":{"id":"c2614965702b481f","repo":"risingwavelabs/risingwave","slug":"array-error-0","errorCode":null,"errorMessage":"Array error: {0}","messagePattern":"Array error: (.+?)","errorType":"error_code","errorClass":"BatchError","httpStatus":null,"severity":"error","filePath":"src/batch/src/error.rs","lineNumber":50,"sourceCode":"use tokio_postgres::Error as PostgresError;\nuse tonic::Status;\n\npub type Result<T> = std::result::Result<T, BatchError>;\n/// Batch result with shared error.\npub type SharedResult<T> = std::result::Result<T, Arc<BatchError>>;\n\npub trait Error = std::error::Error + Send + Sync + 'static;\n\n#[derive(Error, Debug, Construct)]\npub enum BatchError {\n    #[error(\"Storage error: {0}\")]\n    Storage(\n        #[backtrace]\n        #[from]\n        StorageError,\n    ),\n\n    #[error(\"Array error: {0}\")]\n    Array(\n        #[from]\n        #[backtrace]\n        ArrayError,\n    ),\n\n    #[error(\"Expr error: {0}\")]\n    Expr(\n        #[from]\n        #[backtrace]\n        ExprError,\n    ),\n\n    #[error(\"Serialize/deserialize error: {0}\")]\n    Serde(\n        #[source]\n        #[backtrace]\n        BoxedError,","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/batch/src/error.rs#L32-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"Queries with mismatched or unrepresentable literal types for a column; invalid casts on array columns; bugs in expression evaluation over nested/array types.","solutions":["Read the wrapped ArrayError message to identify which column/type operation failed.","Fix the query: cast literals/values explicitly to match the column type (e.g. use explicit ::casts).","Validate array literals and nesting depth match the column schema.","If triggered by a valid query, file a bug with the SQL and the inner ArrayError."],"exampleFix":"// before: literal type does not match column\nINSERT INTO t(arr) VALUES (ARRAY[1, 'a']);\n// after: explicit, consistent element type\nINSERT INTO t(arr) VALUES (ARRAY[1, 2]::INT[]);","handlingStrategy":"validation","validationCode":"// SQL: ensure literal types match column schema before executing\n-- e.g. SELECT ARRAY[1,2]::INT[] = arr FROM t;","typeGuard":null,"tryCatchPattern":"match result {\n    Err(BatchError::Array(arr_err)) => {\n        // surface arr_err to the user with column/type context\n    }\n    other => other,\n}","preventionTips":["Use explicit casts so literal types match array column types.","Validate array literals' element type and nesting against the schema.","Add expression-level tests for array columns."],"tags":["batch","array","type-mismatch","expression"],"backgroundTag":"type-mismatch","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"}