{"record":{"id":"19592e7e04badd10","repo":"risingwavelabs/risingwave","slug":"invalid-list-encoding-0","errorCode":null,"errorMessage":"Invalid list encoding: {0}","messagePattern":"Invalid list encoding: (.+?)","errorType":"error_code","errorClass":"ValueEncodingError","httpStatus":null,"severity":"error","filePath":"src/common/src/util/value_encoding/error.rs","lineNumber":41,"sourceCode":"    #[error(\"Invalid Date value encoding: days: {0}\")]\n    InvalidDateEncoding(i32),\n    #[error(\"invalid Timestamp value encoding: secs: {0} nsecs: {1}\")]\n    InvalidTimestampEncoding(i64, u32),\n    #[error(\"invalid Time value encoding: secs: {0} nano: {1}\")]\n    InvalidTimeEncoding(u32, u32),\n    #[error(\"Invalid null tag value encoding: {0}\")]\n    InvalidTagEncoding(u8),\n    #[error(\"Invalid jsonb encoding\")]\n    InvalidJsonbEncoding,\n    #[error(\"Invalid variant encoding\")]\n    InvalidVariantEncoding,\n    #[error(\"Invalid struct encoding: {0}\")]\n    InvalidStructEncoding(\n        #[source]\n        #[backtrace]\n        crate::array::ArrayError,\n    ),\n    #[error(\"Invalid list encoding: {0}\")]\n    InvalidListEncoding(\n        #[source]\n        #[backtrace]\n        crate::array::ArrayError,\n    ),\n    #[error(\"Invalid flag: {0:b}\")]\n    InvalidFlag(u8),\n    #[error(\"Invalid vector item: {0} {1}\")]\n    InvalidVectorItem(f32, String),\n}\n","sourceCodeStart":23,"sourceCodeEnd":52,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/common/src/util/value_encoding/error.rs#L23-L52","documentation":"ValueEncodingError::InvalidListEncoding wraps a crate::array::ArrayError and is raised when deserializing a List (array) datum fails. deserialize_list (src/common/src/util/value_encoding/mod.rs:407+) reads the u32_le length prefix and decodes each element with the list's element type; failures decoding the element data (including ArrayError from building the ListArray) surface as this variant. The wrapped source identifies the failing element decode.","triggerScenarios":"Decoding DataType::List where the length prefix exceeds remaining bytes, elements were written with a different element type, or element bytes are truncated/corrupt.","commonSituations":"Element type changed for a list column between writer and reader; truncated payloads from storage corruption; version skew in list encoding layout; test fixtures with hand-built bytes.","solutions":["Check the wrapped ArrayError to identify the failing element decode","Verify the reader's ListType element type matches the writer's","Validate the u32 length prefix against the remaining buffer before decoding","Re-ingest or rewrite rows whose list bytes are corrupt"],"exampleFix":"// before\nlet len = data.get_u32_le() as usize;\nfor _ in 0..len { inner_deserialize_datum(data, elem_type)?; }\n// after: guard the length prefix against remaining bytes\nlet len = data.get_u32_le() as usize;\nif len > data.remaining() { return Err(ValueEncodingError::InvalidListEncoding(/* ArrayError for truncated payload */)); }","handlingStrategy":"validation","validationCode":"fn list_len_valid(data: &impl Buf) -> bool {\n    // peek the u32_le length prefix without consuming\n    let head = &data.chunk()[..4.min(data.chunk().len())];\n    head.len() == 4 && u32::from_le_bytes(head.try_into().unwrap()) as usize <= data.remaining()\n}","typeGuard":"fn is_decodable_list(data: &impl Buf) -> bool {\n    data.remaining() >= 4 && {\n        let mut peek = data;\n        let n = peek.get_u32_le() as usize;\n        n <= peek.remaining()\n    }\n}","tryCatchPattern":"match deserialize_datum(&DataType::List(list_type), data) {\n    Ok(v) => { /* use value */ }\n    Err(ValueEncodingError::InvalidListEncoding(src)) => {\n        tracing::error!(\"list element decode failed: {src}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate the u32_le element-count prefix against remaining buffer size before looping","Keep the list element type identical between writer and reader","Add round-trip encode/decode tests for list columns including empty lists","Check the wrapped ArrayError source to identify element-level failures"],"tags":["rust","value-encoding","list","array","deserialization"],"backgroundTag":"schema-validation-failed","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}