risingwavelabs/risingwave · error

failed to deserialize MySQL value into rw value

Error message

failed to deserialize MySQL value into rw value

What it means

Second arm of `handle_data_type!` (RW-type conversion path): the MySQL client returned `Some(Err(e))` from `take_opt`, wrapped with context "failed to deserialize MySQL value into rw value" plus column name, index, and target RW type. The raw value could not be read/converted into the intermediate RisingWave scalar type.

Source

Thrown at src/connector/src/parser/mysql.rs:54

    ($row:expr, $i:expr, $name:expr, $typ:ty) => {{
        match $row.take_opt::<Option<$typ>, _>($i) {
            None => bail!("no value found at column: {}, index: {}", $name, $i),
            Some(Ok(val)) => Ok(val.map(|v| ScalarImpl::from(v))),
            Some(Err(e)) => Err(anyhow::Error::new(e.clone())
                .context("failed to deserialize MySQL value into rust value")
                .context(format!(
                    "column: {}, index: {}, rust_type: {}",
                    $name,
                    $i,
                    stringify!($typ),
                ))),
        }
    }};
    ($row:expr, $i:expr, $name:expr, $typ:ty, $rw_type:ty) => {{
        match $row.take_opt::<Option<$typ>, _>($i) {
            None => bail!("no value found at column: {}, index: {}", $name, $i),
            Some(Ok(val)) => Ok(val.map(|v| ScalarImpl::from(<$rw_type>::from(v)))),
            Some(Err(e)) => Err(anyhow::Error::new(e.clone())
                .context("failed to deserialize MySQL value into rw value")
                .context(format!(
                    "column: {}, index: {}, rw_type: {}",
                    $name,
                    $i,
                    stringify!($rw_type),
                ))),
        }
    }};
}

macro_rules! handle_data_type_with_signed {
    (
        $mysql_row:expr,
        $mysql_datum_index:expr,
        $column_name:expr,
        $signed_type:ty,
        $unsigned_type:ty

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Inspect the wrapped inner error plus the column/index/rw_type context to pinpoint the failing column.
  2. Correct the RW column type (or the type mapping entry) to match the actual MySQL column type.
  3. Fix or remove the offending data upstream and restart the snapshot/replication.
Defensive patterns

Strategy: try-catch

Try / catch

match decode_col_rw(row, idx, name) {
    Err(e) if e.to_string().contains("failed to deserialize MySQL value into rw value") => {
        tracing::error!("rw conversion failed: {e:#}");
        quarantine_row(row_id);
    }
    other => other?,
}

Prevention

When it happens

Trigger: The MySQL value at column `$i` cannot be deserialized into `$rw_type` (wire type incompatible with the RW conversion, e.g. non-numeric text read into a Decimal/Int conversion).

Common situations: Upstream column type change not reflected in the RW schema; unsigned/precision conversions failing; charset or data corruption in a specific row; wrong entry in the MySQL-to-RW type mapping.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/3a297c7ff7b9bafa. Report an issue: GitHub.