{"record":{"id":"ae7668bac94a5fe9","repo":"risingwavelabs/risingwave","slug":"invalid-value-for-boolean","errorCode":null,"errorMessage":"invalid value for boolean: {:?}","messagePattern":"invalid value for boolean: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/parser/mysql.rs","lineNumber":136,"sourceCode":"            // This handles backwards compatibility,\n            // before https://github.com/risingwavelabs/risingwave/pull/19071\n            // we permit boolean and tinyint(1) to be equivalent to boolean in RW.\n            if let Some(Ok(val)) = mysql_row.get_opt::<Option<bool>, _>(mysql_datum_index) {\n                return Ok(val.map(ScalarImpl::from));\n            }\n            // Bit(1)\n            match mysql_row.take_opt::<Option<Vec<u8>>, _>(mysql_datum_index) {\n                None => bail!(\n                    \"no value found at column: {}, index: {}\",\n                    column_name,\n                    mysql_datum_index\n                ),\n                Some(Ok(val)) => match val {\n                    None => Ok(None),\n                    Some(val) => match val.as_slice() {\n                        [0] => Ok(Some(ScalarImpl::from(false))),\n                        [1] => Ok(Some(ScalarImpl::from(true))),\n                        _ => Err(anyhow!(\"invalid value for boolean: {:?}\", val)),\n                    },\n                },\n                Some(Err(e)) => Err(anyhow::Error::new(e)\n                    .context(\"failed to deserialize MySQL value into rust value\")\n                    .context(format!(\n                        \"column: {}, index: {}, rust_type: Vec<u8>\",\n                        column_name, mysql_datum_index,\n                    ))),\n            }\n        }\n        DataType::Int16 => {\n            handle_data_type!(mysql_row, mysql_datum_index, column_name, i16)\n        }\n        DataType::Int32 => {\n            handle_data_type!(mysql_row, mysql_datum_index, column_name, i32)\n        }\n        DataType::Int64 => {\n            handle_data_type_with_signed!(mysql_row, mysql_datum_index, column_name, i64, u64)","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/parser/mysql.rs#L118-L154","documentation":"Raised in `mysql_datum_to_rw_datum` when a Boolean column's value is fetched as a byte vector (Bit(1) path) but the byte slice is neither exactly `[0]` nor `[1]`. RisingWave only maps those two exact bit patterns to false/true; any other byte sequence (e.g. multi-byte BIT values) is rejected with the offending value in the message.","triggerScenarios":"Decoding a MySQL `BIT(n)` column with n > 1 (returns multi-byte Vec<u8>) as a RisingWave BOOLEAN; a corrupt or unexpected binary payload in the bool column.","commonSituations":"Using a MySQL BIT(8)/BIT(n>1) column mapped to BOOLEAN in the CREATE SOURCE statement; upstream application writing values other than b'0'/b'1' into a BIT column.","solutions":["Change the MySQL column to BIT(1) or TINYINT(1) if boolean semantics are intended.","Change the RisingWave source column type to a matching type (e.g. BYTEA/VARCHAR) instead of BOOLEAN for BIT(n>1) columns.","Sanitize application writes to only store 0/1 in BIT columns consumed by RisingWave."],"exampleFix":"// before: BIT(8) mapped as BOOLEAN in RW source\nflags BIT(8)  -- source column: flags BOOLEAN\n// after: widen or remap\n-- MySQL: ALTER TABLE t MODIFY flags BIT(1);  or RW: flags BYTEA","handlingStrategy":"validation","validationCode":"-- Ensure the column is single-bit before mapping to BOOLEAN:\nSELECT CHARACTER_MAXIMUM_LENGTH FROM information_schema.columns\nWHERE table_name='t' AND column_name='flags';  -- must be 1 for BIT","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only map BIT(1) or TINYINT(1) columns to RW BOOLEAN.","Restrict application writes to 0/1 in bit columns.","Declare BIT(n>1) columns as BYTEA/VARCHAR in the RW source."],"tags":["mysql","cdc","boolean","type-mismatch"],"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"}