{"record":{"id":"35407e38eeca41ed","repo":"risingwavelabs/risingwave","slug":"invalid-null-tag-value-encoding-0","errorCode":null,"errorMessage":"Invalid null tag value encoding: {0}","messagePattern":"Invalid null tag value encoding: (.+?)","errorType":"error_code","errorClass":"ValueEncodingError","httpStatus":null,"severity":"error","filePath":"src/common/src/util/value_encoding/error.rs","lineNumber":29,"sourceCode":"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nuse thiserror::Error;\n\n#[derive(Error, Debug)]\npub enum ValueEncodingError {\n    #[error(\"Invalid bool value encoding: {0}\")]\n    InvalidBoolEncoding(u8),\n    #[error(\"Invalid UTF8 value encoding: {0}\")]\n    InvalidUtf8(#[from] std::string::FromUtf8Error),\n    #[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}\")]","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/common/src/util/value_encoding/error.rs#L11-L47","documentation":"`ValueEncodingError::InvalidTagEncoding` is raised when decoding a nullable value-encoded datum: each encoded value starts with a one-byte null tag, and only 0 (null) and 1 (non-null) are valid. Any other byte means the buffer is not a well-formed value-encoded nullable datum or the reader is misaligned.","triggerScenarios":"Decoding an optional/nullable column whose leading byte is not 0 or 1 — reading at a wrong offset, decoding a non-value-encoded buffer, or hand-written encoders writing other tag bytes (e.g. 0xFF).","commonSituations":"Corrupted or truncated serialized data, version/format skew between producers and consumers, manual construction of value-encoded bytes with wrong tag conventions, misaligned row slicing.","solutions":["Check the offending tag byte in the message; ensure nullable values are encoded with tag 0 (null) or 1 (value)","Verify the decode offset — the tag byte must be the first byte of each datum","Ensure the producer used RisingWave's value-encoding Option encoder rather than a custom format","Re-produce or resync the corrupted data source"],"exampleFix":"// before\nlet mut buf = vec![2u8]; // invalid null tag\nbuf.extend_from_slice(&42i32.to_be_bytes());\n// after\nlet mut buf = vec![1u8]; // 1 = present, 0 = null\nbuf.extend_from_slice(&42i32.to_be_bytes());","handlingStrategy":"try-catch","validationCode":"// check the leading null tag before decoding an optional datum\nfn is_valid_null_tag(bytes: &[u8]) -> bool {\n    matches!(bytes.first(), Some(0) | Some(1))\n}\n","typeGuard":"fn null_tag(b: u8) -> Option<bool> { match b { 0 => Some(false), 1 => Some(true), _ => None } }","tryCatchPattern":"match Option::<i32>::try_from_value_encoding(bytes) {\n    Ok(v) => v,\n    Err(ValueEncodingError::InvalidTagEncoding(tag)) => {\n        // treat as corrupt: skip record or fail the pipeline\n        return Err(anyhow!(\"invalid null tag {tag}\"));\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Encode nullable values with tag byte 0 (null) or 1 (value) only","Ensure the tag byte is read at the exact start of each datum","Keep producer/consumer encodings and versions aligned","Add integrity checks on serialized payloads to catch truncation"],"tags":["value-encoding","null-tag","deserialization","risingwave"],"backgroundTag":"invalid-argument-value","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"}