risingwavelabs/risingwave · error

unsupported encoding for DEBEZIUM_MONGO format

Error message

unsupported encoding for DEBEZIUM_MONGO format

What it means

This error is thrown by `build_accessor_builder` in the Debezium MongoDB JSON parser when the encoding properties passed in are not `EncodingProperties::MongoJson`. The DEBEZIUM_MONGO format only supports the MongoJson access builder, so any other encoding (Json, Avro, Protobuf, etc.) is rejected at parser construction time. It is a configuration/enum-dispatch guard ensuring the accessor matches the declared format.

Source

Thrown at src/connector/src/parser/debezium/mongo_json_parser.rs:44

    AccessBuilderImpl, ByteStreamSourceParser, EncodingProperties,
    MongoProperties as MongoEncodingProperties, ParserFormat, SourceStreamChunkRowWriter,
};
use crate::source::{SourceColumnDesc, SourceContext, SourceContextRef};

#[derive(Debug)]
pub struct DebeziumMongoJsonParser {
    pub(crate) rw_columns: Vec<SourceColumnDesc>,
    source_ctx: SourceContextRef,
    key_builder: AccessBuilderImpl,
    payload_builder: AccessBuilderImpl,
}

fn build_accessor_builder(config: EncodingProperties) -> anyhow::Result<AccessBuilderImpl> {
    match config {
        EncodingProperties::MongoJson(mongo_props) => Ok(AccessBuilderImpl::DebeziumMongoJson(
            DebeziumMongoJsonAccessBuilder::new(mongo_props)?,
        )),
        _ => bail!("unsupported encoding for DEBEZIUM_MONGO format"),
    }
}

impl DebeziumMongoJsonParser {
    pub fn new(
        rw_columns: Vec<SourceColumnDesc>,
        source_ctx: SourceContextRef,
        props: MongoEncodingProperties,
    ) -> ConnectorResult<Self> {
        let _id_column = rw_columns
            .iter()
            .find(|desc| {
                desc.name == "_id"
                    && matches!(
                        desc.data_type,
                        DataType::Jsonb
                            | DataType::Varchar
                            | DataType::Int32

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Ensure the source's encoding config produces `EncodingProperties::MongoJson` when format is DEBEZIUM_MONGO (check the properties passed to `DebeziumMongoJsonParser::new`).
  2. Verify the connector options: use format=debezium_mongo with the matching mongo-specific encoding options rather than generic json/avro options.
  3. If you are writing code that builds parsers, make sure the format-to-encoding mapping sends MongoJson properties to this parser (inspect the match in the parser registry).

Example fix

// before
let props = EncodingProperties::Json(json_props);
DebeziumMongoJsonParser::new(rw_columns, props, source_ctx).await?;
// after
let props = EncodingProperties::MongoJson(mongo_props);
DebeziumMongoJsonParser::new(rw_columns, props, source_ctx).await?
Defensive patterns

Strategy: validation

Validate before calling

if !matches!(encoding_props, EncodingProperties::MongoJson(_)) {
    return Err(anyhow!("DEBEZIUM_MONGO requires MongoJson encoding properties"));
}

Type guard

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

Prevention

When it happens

Trigger: Calling `DebeziumMongoJsonParser::new` (which calls `build_accessor_builder`) with an `EncodingProperties` variant other than `MongoJson`, e.g. constructing a DEBEZIUM_MONGO source whose connector-level encoding config resolved to Json or Avro properties.

Common situations: A misconfigured CDC source where the `debezium_mongo` format was selected but the encoding properties were derived from a generic JSON/Avro connector config; internal code wiring an encoding enum to the wrong parser format; a refactor that changed how EncodingProperties is built for Mongo.

Related errors


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