risingwavelabs/risingwave · error

unsupported encoding for Maxwell

Error message

unsupported encoding for Maxwell

What it means

`MaxwellParser::new` only supports a specific set of encodings for the Maxwell CDC format; when the provided `EncodingProperties` variant falls through the match to the `_` arm, this error is raised. Maxwell messages are JSON-based, so encodings like Avro or Protobuf are rejected at parser construction.

Source

Thrown at src/connector/src/parser/maxwell/maxwell_parser.rs:49

    source_ctx: SourceContextRef,
}

impl MaxwellParser {
    pub async fn new(
        props: SpecificParserConfig,
        rw_columns: Vec<SourceColumnDesc>,
        source_ctx: SourceContextRef,
    ) -> ConnectorResult<Self> {
        match props.encoding_config {
            EncodingProperties::Json(_) => {
                let payload_builder = AccessBuilderImpl::new_default(props.encoding_config).await?;
                Ok(Self {
                    payload_builder,
                    rw_columns,
                    source_ctx,
                })
            }
            _ => bail!("unsupported encoding for Maxwell"),
        }
    }

    pub async fn parse_inner(
        &mut self,
        payload: Vec<u8>,
        mut writer: SourceStreamChunkRowWriter<'_>,
    ) -> ConnectorResult<()> {
        let m = writer.source_meta();
        let payload_accessor = self.payload_builder.generate_accessor(payload, m).await?;
        let row_op = MaxwellChangeEvent::new(payload_accessor);

        apply_row_operation_on_stream_chunk_writer(row_op, &mut writer).map_err(Into::into)
    }
}

impl ByteStreamSourceParser for MaxwellParser {
    fn columns(&self) -> &[SourceColumnDesc] {

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Use JSON encoding with format=maxwell (remove or change the encoding option so it resolves to a supported Json properties variant).
  2. Check the source's WITH options for an `encoding`/schema-registry setting that forces Avro; drop it for Maxwell.
  3. If building parsers in code, verify the encoding enum passed to `MaxwellParser::new` matches one of the supported arms in the match.

Example fix

// before
let props = EncodingProperties::Avro(avro_props);
MaxwellParser::new(rw_columns, props, source_ctx).await?;
// after
let props = EncodingProperties::Json(json_props);
MaxwellParser::new(rw_columns, props, source_ctx).await?
Defensive patterns

Strategy: validation

Validate before calling

if !matches!(encoding_props, EncodingProperties::Json(_)) {
    return Err(anyhow!("Maxwell format only supports JSON encoding"));
}

Type guard

fn is_json_encoding(props: &EncodingProperties) -> bool { matches!(props, EncodingProperties::Json(_)) }

Prevention

When it happens

Trigger: Constructing a Maxwell parser with `EncodingProperties` other than the supported JSON variants (e.g. Avro or Protobuf properties) via the parser dispatch when a source declares format=maxwell with a non-JSON encoding.

Common situations: Mixing connector options: setting format=maxwell but encoding=avro; copying an Avro-based Debezium source definition and only changing the format; internal dispatch building Maxwell parsers from the wrong encoding enum.

Related errors


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