{"record":{"id":"7106103edf87c62c","repo":"risingwavelabs/risingwave","slug":"unsupported-encoding-for-debezium-mongo-format","errorCode":null,"errorMessage":"unsupported encoding for DEBEZIUM_MONGO format","messagePattern":"unsupported encoding for DEBEZIUM_MONGO format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/parser/debezium/mongo_json_parser.rs","lineNumber":44,"sourceCode":"    AccessBuilderImpl, ByteStreamSourceParser, EncodingProperties,\n    MongoProperties as MongoEncodingProperties, ParserFormat, SourceStreamChunkRowWriter,\n};\nuse crate::source::{SourceColumnDesc, SourceContext, SourceContextRef};\n\n#[derive(Debug)]\npub struct DebeziumMongoJsonParser {\n    pub(crate) rw_columns: Vec<SourceColumnDesc>,\n    source_ctx: SourceContextRef,\n    key_builder: AccessBuilderImpl,\n    payload_builder: AccessBuilderImpl,\n}\n\nfn build_accessor_builder(config: EncodingProperties) -> anyhow::Result<AccessBuilderImpl> {\n    match config {\n        EncodingProperties::MongoJson(mongo_props) => Ok(AccessBuilderImpl::DebeziumMongoJson(\n            DebeziumMongoJsonAccessBuilder::new(mongo_props)?,\n        )),\n        _ => bail!(\"unsupported encoding for DEBEZIUM_MONGO format\"),\n    }\n}\n\nimpl DebeziumMongoJsonParser {\n    pub fn new(\n        rw_columns: Vec<SourceColumnDesc>,\n        source_ctx: SourceContextRef,\n        props: MongoEncodingProperties,\n    ) -> ConnectorResult<Self> {\n        let _id_column = rw_columns\n            .iter()\n            .find(|desc| {\n                desc.name == \"_id\"\n                    && matches!(\n                        desc.data_type,\n                        DataType::Jsonb\n                            | DataType::Varchar\n                            | DataType::Int32","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/parser/debezium/mongo_json_parser.rs#L26-L62","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the source's encoding config produces `EncodingProperties::MongoJson` when format is DEBEZIUM_MONGO (check the properties passed to `DebeziumMongoJsonParser::new`).","Verify the connector options: use format=debezium_mongo with the matching mongo-specific encoding options rather than generic json/avro options.","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)."],"exampleFix":"// before\nlet props = EncodingProperties::Json(json_props);\nDebeziumMongoJsonParser::new(rw_columns, props, source_ctx).await?;\n// after\nlet props = EncodingProperties::MongoJson(mongo_props);\nDebeziumMongoJsonParser::new(rw_columns, props, source_ctx).await?","handlingStrategy":"validation","validationCode":"if !matches!(encoding_props, EncodingProperties::MongoJson(_)) {\n    return Err(anyhow!(\"DEBEZIUM_MONGO requires MongoJson encoding properties\"));\n}","typeGuard":"fn is_mongo_json(props: &EncodingProperties) -> bool { matches!(props, EncodingProperties::MongoJson(_)) }","tryCatchPattern":null,"preventionTips":["Always build encoding properties from the same format enum that selects the parser.","Add a unit test asserting the format->encoding mapping for DEBEZIUM_MONGO yields MongoJson."],"tags":["cdc","debezium","mongo","encoding","config"],"backgroundTag":"unsupported-enum-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"}