{"record":{"id":"a758e56fd90e5fc7","repo":"risingwavelabs/risingwave","slug":"only-json-format-is-supported-for-now","errorCode":null,"errorMessage":"only json format is supported for now","messagePattern":"only json format is supported for now","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/source/datagen/source/generator.rs","lineNumber":129,"sourceCode":"                                        if value.is_null() {\n                                            reach_end = true;\n                                            tracing::info!(\n                                                \"datagen split {} stop generate, offset {}\",\n                                                self.split_id,\n                                                self.offset\n                                            );\n                                            break 'outer;\n                                        }\n                                        value\n                                    }\n                                };\n\n                                map.insert(name.clone(), value);\n                            }\n                            serde_json::Value::from(map).to_string().as_bytes().to_vec()\n                        }\n                        _ => {\n                            unimplemented!(\"only json format is supported for now\")\n                        }\n                    };\n                    msgs.push(SourceMessage {\n                        key: None,\n                        payload: Some(payload),\n                        offset: self.offset.to_string(),\n                        split_id: self.split_id.clone(),\n                        meta: SourceMeta::Datagen(DatagenMeta {\n                            timestamp: Some(\n                                SystemTime::now()\n                                    .duration_since(UNIX_EPOCH)\n                                    .unwrap()\n                                    .as_millis() as i64,\n                            ),\n                        }),\n                    });\n                    self.offset += 1;\n                    rows_generated_this_second += 1;","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/source/datagen/source/generator.rs#L111-L147","documentation":"The datagen source can only serialize generated rows in JSON format; any other declared row format reaches an `unimplemented!` branch that panics with \"only json format is supported for now\". The generator builds a JSON object map per row and has no encoder for other formats.","triggerScenarios":"Creating a datagen source/table whose WITH options declare a format other than JSON, e.g. `FORMAT PLAIN ENCODE AVRO` / `ENCODE PROTOBUF` / `ENCODE BYTES`, then consuming rows — the map-to-payload match hits the `_` arm.","commonSituations":"Copying a Kafka source definition onto datagen; assuming datagen supports Avro/Protobuf for schema-registry testing; typos like ENCODE='JSONB'.","solutions":["Use `FORMAT PLAIN ENCODE JSON` in the datagen source's WITH clause.","If binary-format testing is needed, use a real Kafka connector with Avro/Protobuf instead of datagen.","Implement additional encoding arms in generator.rs `into_msg_stream` if you control the build."],"exampleFix":"// before\nCREATE TABLE t WITH (connector='datagen', FORMAT PLAIN ENCODE AVRO, ...);\n// after\nCREATE TABLE t WITH (connector='datagen', FORMAT PLAIN ENCODE JSON, ...);","handlingStrategy":"validation","validationCode":"// Validate the WITH clause before creating a datagen table:\nif (/ENCODE\\s+(AVRO|PROTOBUF|BYTES)/i.test(withClause)) {\n  throw new Error('datagen only supports ENCODE JSON');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use FORMAT PLAIN ENCODE JSON with datagen sources.","Do not copy Kafka connector WITH options onto datagen.","Check connector docs for supported encodings per connector type."],"tags":["datagen","encoding","json","unimplemented"],"backgroundTag":"unsupported-operation","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}