{"record":{"id":"1ec594322c322a0d","repo":"apache/flink","slug":"please-invoke-deserializationschema-deserialize-by","errorCode":null,"errorMessage":"Please invoke DeserializationSchema#deserialize(byte[], Collector<RowData>) instead.","messagePattern":"Please invoke DeserializationSchema#deserialize\\(byte\\[\\], Collector<RowData>\\) instead\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/debezium/DebeziumAvroDeserializationSchema.java","lineNumber":124,"sourceCode":"                        producedTypeInfo);\n    }\n\n    @VisibleForTesting\n    DebeziumAvroDeserializationSchema(\n            TypeInformation<RowData> producedTypeInfo,\n            AvroRowDataDeserializationSchema avroDeserializer) {\n        this.producedTypeInfo = producedTypeInfo;\n        this.avroDeserializer = avroDeserializer;\n    }\n\n    @Override\n    public void open(InitializationContext context) throws Exception {\n        avroDeserializer.open(context);\n    }\n\n    @Override\n    public RowData deserialize(byte[] message) throws IOException {\n        throw new RuntimeException(\n                \"Please invoke DeserializationSchema#deserialize(byte[], Collector<RowData>) instead.\");\n    }\n\n    @Override\n    public void deserialize(byte[] message, Collector<RowData> out) throws IOException {\n\n        if (message == null || message.length == 0) {\n            // skip tombstone messages\n            return;\n        }\n        try {\n            GenericRowData row = (GenericRowData) avroDeserializer.deserialize(message);\n\n            GenericRowData before = (GenericRowData) row.getField(0);\n            GenericRowData after = (GenericRowData) row.getField(1);\n            String op = row.getField(2).toString();\n            if (OP_CREATE.equals(op) || OP_READ.equals(op)) {\n                after.setRowKind(RowKind.INSERT);","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/debezium/DebeziumAvroDeserializationSchema.java#L106-L142","documentation":"RuntimeException from DebeziumAvroDeserializationSchema.deserialize(byte[]): this class only supports the collector-based variant, which must output both the 'before' and 'after' rows for UPDATE events and cannot return a single value. The single-argument overload is intentionally blocked.","triggerScenarios":"Calling DeserializationSchema#deserialize(byte[]) on a DebeziumAvroDeserializationSchema instance — e.g. a custom Kafka consumer, a test harness, or a generic framework invoking the one-arg method by default instead of passing a Collector.","commonSituations":"User code or older connector versions that only call the single-message API; unit tests calling deserialize(message) directly.","solutions":["Call deserialize(byte[] message, Collector<RowData> out) instead and collect from the collector.","If integrating with an API that requires the one-arg form, use the plain (non-Debezium) AvroRowDataDeserializationSchema instead."],"exampleFix":"// before\nRowData row = schema.deserialize(message);\n\n// after\nList<RowData> out = new ArrayList<>();\nschema.deserialize(message, out::add); // UPDATE emits before+after rows","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"static boolean supportsSingleArgDeserialize(DeserializationSchema<?> d) {\n    return !(d instanceof DebeziumAvroDeserializationSchema);\n}","tryCatchPattern":"try {\n    RowData r = schema.deserialize(message);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"Collector<RowData>\")) {\n        // switch to the collector overload: schema.deserialize(message, collector)\n    }\n    throw e;\n}","preventionTips":["Always call the collector-based deserialize(byte[], Collector) for CDC deserializers.","In tests, collect into a List<RowData> and assert on all emitted rows (UPDATE yields two)."],"tags":["avro","debezium","cdc","api-misuse","flink"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}