apache/flink · error · RuntimeException
Could not serialize row '%s'.
Error message
Could not serialize row '%s'.
What it means
Outer catch in DebeziumAvroSerializationSchema.serialize(): any Throwable raised while building the Debezium envelope GenericRecord or running the Avro serializer is re-thrown as RuntimeException("Could not serialize row '%s'."). The offending RowData is rendered into the message and the root cause is attached; diagnose via the cause, not the wrapper text.
Source
Thrown at flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/debezium/DebeziumAvroSerializationSchema.java:129
case UPDATE_AFTER:
outputReuse.setField(0, null);
outputReuse.setField(1, rowData);
outputReuse.setField(2, OP_INSERT);
return avroSerializer.serialize(outputReuse);
case UPDATE_BEFORE:
case DELETE:
outputReuse.setField(0, rowData);
outputReuse.setField(1, null);
outputReuse.setField(2, OP_DELETE);
return avroSerializer.serialize(outputReuse);
default:
throw new UnsupportedOperationException(
format(
"Unsupported operation '%s' for row kind.",
rowData.getRowKind()));
}
} catch (Throwable t) {
throw new RuntimeException(format("Could not serialize row '%s'.", rowData), t);
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DebeziumAvroSerializationSchema that = (DebeziumAvroSerializationSchema) o;
return Objects.equals(avroSerializer, that.avroSerializer);
}
@Override
public int hashCode() {
return Objects.hash(avroSerializer);View on GitHub (pinned to 2f3c205e92)
Solutions
- Inspect getCause() — fix whichever nested exception (UnsupportedOperationException, AvroTypeException, RestServiceException) is the real failure.
- If the cause is the RowKind error, normalize kinds as per error 1325.
- Verify the registry URL/credentials from TaskManagers: curl http://<registry>/subjects and confirm the subject is writable.
- Reconcile table DDL with the target Avro schema (types and nullability of before/after).
Defensive patterns
Strategy: try-catch
Try / catch
catch (RuntimeException e) { Throwable root = deepest(e); if (root instanceof RestServiceException) retry/alert registry; else if (root instanceof UnsupportedOperationException) fix row kind; else surface row from message to DLQ; } Prevention
- Unit-test serialize() with representative rows (nulls, all kinds) before deploying
- Verify registry credentials with curl before job start
- Keep table DDL and Avro schema in sync via schema-registry CI checks
When it happens
Trigger: Type mismatches between the RowData and the Avro schema used by avroSerializer (e.g. string vs bytes), nulls written into non-nullable envelope fields, Avro registry client failures during schema registration, or the unsupported-RowKind UnsupportedOperationException (error 1325) bubbling up as the cause.
Common situations: DDL columns whose types drift from the registered subject schema; registry auth (basic/bearer) misconfigured so schema registration fails on first serialize; nulls in key columns.
Related errors
- Can't deserialize Debezium Avro message.
- Unknown "op" value "%s". The Debezium Avro message is '%s'
- Unsupported operation '%s' for row kind.
- Could not serialize row '%s'.
- Could not instantiate org.apache.flink.formats.avro.utils.Av
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/b41ba14b325f8943.
Report an issue: GitHub.