{"record":{"id":"293349d6f3f9006d","repo":"apache/flink","slug":"can-t-deserialize-debezium-avro-message","errorCode":null,"errorMessage":"Can't deserialize Debezium Avro message.","messagePattern":"Can't deserialize Debezium Avro message\\.","errorType":"exception","errorClass":"IOException","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":168,"sourceCode":"                after.setRowKind(RowKind.UPDATE_AFTER);\n                out.collect(before);\n                out.collect(after);\n            } else if (OP_DELETE.equals(op)) {\n                if (before == null) {\n                    throw new IllegalStateException(\n                            String.format(REPLICA_IDENTITY_EXCEPTION, \"DELETE\"));\n                }\n                before.setRowKind(RowKind.DELETE);\n                out.collect(before);\n            } else {\n                throw new IOException(\n                        format(\n                                \"Unknown \\\"op\\\" value \\\"%s\\\". The Debezium Avro message is '%s'\",\n                                op, new String(message)));\n            }\n        } catch (Throwable t) {\n            // a big try catch to protect the processing.\n            throw new IOException(\"Can't deserialize Debezium Avro message.\", t);\n        }\n    }\n\n    @Override\n    public boolean isEndOfStream(RowData nextElement) {\n        return false;\n    }\n\n    @Override\n    public TypeInformation<RowData> getProducedType() {\n        return producedTypeInfo;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }","sourceCodeStart":150,"sourceCodeEnd":186,"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#L150-L186","documentation":"This is the outer safety net of DebeziumAvroDeserializationSchema.deserialize(): every Throwable thrown while decoding an Avro record or converting before/after images (NPEs, Avro decoder errors, converter type mismatches, and the wrapped replica-identity IllegalStateExceptions) is caught and re-thrown as IOException(\"Can't deserialize Debezium Avro message.\"). The original cause is always attached; the real diagnosis lives in the cause chain, not this message.","triggerScenarios":"Any decode/conversion failure inside deserialize(): registry lookup failures for the writer schema ID, Avro datum resolution errors, RowData converter type mismatches between the registered Avro schema and the declared Flink table schema, or the before==null replica-identity errors (errors 1320/1321 nested as causes).","commonSituations":"Schema evolution in the registry producing an incompatible reader schema; Flink table columns reordered or retyped relative to the Debezium schema; transient schema-registry connectivity blips; the underlying causes described for the REPLICA_IDENTITY and unknown-op errors.","solutions":["Read the full cause chain (getCause()) of the IOException — the actionable error is the nested exception, not this wrapper.","If the cause is the replica-identity IllegalStateException, follow the fix for error 1320 (ALTER TABLE ... REPLICA IDENTITY FULL).","If the cause is an Avro/schema error, verify the Flink table schema matches the Debezium 'before'/'after' record schema and that the registry serves the writer schema.","If the cause is connectivity, verify 'schema.registry.url' is reachable from TaskManagers and retry from the last checkpoint."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (IOException e) { Throwable root = e; while (root.getCause()!=null) root = root.getCause(); // switch on root: IllegalStateException->replica identity, AvroTypeException->schema mismatch, RestServiceException->registry connectivity }","preventionTips":["Always inspect the full cause chain, never the wrapper message","Keep Flink table schema in lockstep with the Debezium schema via CI schema-diff checks","Enable checkpoints so decode failures resume from a known offset after the cause is fixed"],"tags":["debezium","avro","wrapper-exception","serialization","diagnostics"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}