{"record":{"id":"51f0b1ade049b513","repo":"risingwavelabs/risingwave","slug":"streamchunkarrayerror-error","errorCode":null,"errorMessage":"StreamChunkArrayError {error}","messagePattern":"StreamChunkArrayError (.+?)","errorType":"exception","errorClass":"BindingError::StreamChunkArray","httpStatus":null,"severity":"error","filePath":"src/jni_core/src/lib.rs","lineNumber":105,"sourceCode":"        error: jni::errors::Error,\n        backtrace: Backtrace,\n    },\n\n    #[error(\"StorageError {error}\")]\n    Storage {\n        #[from]\n        error: anyhow::Error,\n        backtrace: Backtrace,\n    },\n\n    #[error(\"DecodeError {error}\")]\n    Decode {\n        #[from]\n        error: DecodeError,\n        backtrace: Backtrace,\n    },\n\n    #[error(\"StreamChunkArrayError {error}\")]\n    StreamChunkArray {\n        #[from]\n        error: ArrayError,\n        backtrace: Backtrace,\n    },\n}\n\ntype Result<T> = std::result::Result<T, BindingError>;\n\npub fn to_guarded_slice<'array, 'env>(\n    array: &'array JByteArray<'env>,\n    env: &'array mut JNIEnv<'env>,\n) -> Result<SliceGuard<'env, 'array>> {\n    unsafe {\n        let array = env.get_array_elements(array, ReleaseMode::NoCopyBack)?;\n        let slice = from_raw_parts(array.as_ptr() as *mut u8, array.len());\n\n        Ok(SliceGuard {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/jni_core/src/lib.rs#L87-L123","documentation":"BindingError::StreamChunkArray wraps ArrayError from the RisingWave array library, raised while constructing or accessing typed arrays (I32Array, Utf8Array, etc.) that back a StreamChunk during JNI conversions. Shown as 'StreamChunkArrayError {error}'. It indicates the array data supplied from the Java side violates the array type invariants (wrong element count, invalid null bitmap, value out of the array's physical type).","triggerScenarios":"JNI entry points that build StreamChunks or columns from Java data where the number of elements doesn't match the chunk cardinality, a null-bitmap is inconsistent, or an integer/string value cannot be stored in the target array type.","commonSituations":"Java connector pushes rows whose column count mismatches the declared schema; inserting a value exceeding the target width (e.g. i64 into i32 column); mismatched visibilities/null masks length.","solutions":["Check that every column's element count equals the StreamChunk cardinality and that visibility/null-bitmap arrays have the same length","Validate Java-side values fit the declared column types before calling the binding","Regenerate schema definitions if columns were altered on one side only","Enable the full report of the wrapped ArrayError in the thrown Java exception to see which array/offset failed"],"exampleFix":"// before\nchunk = StreamChunk.of(values, visibility /* len 2 vs 3 values */); // StreamChunkArrayError\n// after\nassert values.length == visibility.length; // both cardinality 3\nchunk = StreamChunk.of(values, visibility);","handlingStrategy":"validation","validationCode":"// Java, before building a StreamChunk\nif (values.length != cardinality || visibility.length != cardinality)\n    throw new IllegalArgumentException(\"column/visibility length must equal cardinality\");","typeGuard":null,"tryCatchPattern":"try {\n    chunk = StreamChunk.of(values, visibility);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"StreamChunkArrayError\")) {\n        // compare per-column lengths and types with declared schema\n    }\n    throw e;\n}","preventionTips":["Assert all column arrays share the chunk cardinality","Match Java value types to declared column physical types (no i64 into i32)","Keep null-bitmap/visibility lengths equal to row count","Regenerate schema code after column changes"],"tags":["stream-chunk","array","jni","data"],"backgroundTag":"type-mismatch","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}