{"record":{"id":"f8ae7a83c0e123fe","repo":"risingwavelabs/risingwave","slug":"invalid-flag-0-b","errorCode":null,"errorMessage":"Invalid flag: {0:b}","messagePattern":"Invalid flag: (.+?)","errorType":"error_code","errorClass":"ValueEncodingError","httpStatus":null,"severity":"error","filePath":"src/common/src/util/value_encoding/error.rs","lineNumber":47,"sourceCode":"    #[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":29,"sourceCodeEnd":52,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/common/src/util/value_encoding/error.rs#L29-L52","documentation":"ValueEncodingError::InvalidFlag(u8) is raised when the header byte of a column-aware encoded row (src/common/src/util/value_encoding/column_aware_row_encoding.rs:477-481) does not carry the expected magic bit pattern. EncodedBytes::new parses the first byte with Header::from_bits and rejects it if header.magic() is false, formatting the raw byte in binary ({0:b}). It means the bytes being decoded are not a valid column-aware value row at all.","triggerScenarios":"Calling the column-aware deserializer on bytes that are empty, truncated (fewer than 5 header bytes), or produced by the legacy/other row encoding (e.g. plain ValueRowSerializer or serialize_datum output).","commonSituations":"Version skew where old rows were stored in a previous row format before the column-aware format with magic header existed; pointing a decoder at the wrong key/sst region; data corruption; mixing serializer outputs in tests or manual replay tools.","solutions":["Confirm the bytes come from the column-aware serializer (first byte's magic bit set) before decoding","Use the correct deserializer variant matching the storage format/version for those rows","Check for version skew and migrate/rewrite rows stored in the legacy format","If corruption is suspected, restore from replica or re-materialize the affected data"],"exampleFix":"// before: assuming format\nlet row = ColumnAwareDeserializer::deserialize(bytes)?; // InvalidFlag\n// after: check format first\nfn is_column_aware(bytes: &[u8]) -> bool {\n    Header::from_bits(*bytes.first().unwrap_or(&0)).magic()\n}\nlet row = if is_column_aware(bytes) {\n    ColumnAwareDeserializer::deserialize(bytes)?\n} else {\n    LegacyValueRowDeserializer::deserialize(bytes)?\n};","handlingStrategy":"validation","validationCode":"fn has_column_aware_magic(bytes: &[u8]) -> bool {\n    bytes.len() >= 5 && Header::from_bits(bytes[0]).magic()\n}","typeGuard":"fn is_column_aware_row(bytes: &[u8]) -> bool {\n    bytes.first().map_or(false, |b| Header::from_bits(*b).magic())\n}","tryCatchPattern":"match EncodedBytes::new(bytes) {\n    Ok(encoded) => { /* iterate columns */ }\n    Err(ValueEncodingError::InvalidFlag(header)) => {\n        tracing::error!(\"bad row header {header:#010b}; wrong format or corrupt data\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Dispatch on the header magic bit before choosing the row decoder instead of assuming a format","Avoid mixing outputs of different serializers (plain vs column-aware) in the same keyspace","Check for RisingWave version skew with rows written before the column-aware format existed","Verify minimum row size (5 header bytes) before attempting to decode"],"tags":["rust","value-encoding","row-encoding","header","deserialization"],"backgroundTag":"invalid-argument-format","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"}