apache/seatunnel · error · UnsupportedOperationException

Please invoke DeserializationSchema#deserialize(byte[], Coll

Error message

Please invoke DeserializationSchema#deserialize(byte[], Collector<SeaTunnelRow>) instead.

What it means

CompatibleKafkaConnectDeserializationSchema intentionally does not implement the single-argument deserialize(byte[]). Kafka Connect JSON records need the full ConsumerRecord (headers, key/value schemas), so only the deserialize(byte[], Collector) overload carries enough context. Calling the byte[]-only form always throws this UnsupportedOperationException.

Source

Thrown at seatunnel-formats/seatunnel-format-compatible-connect-json/src/main/java/org/apache/seatunnel/format/compatible/kafka/connect/json/CompatibleKafkaConnectDeserializationSchema.java:96

    public CompatibleKafkaConnectDeserializationSchema(
            @NonNull CatalogTable catalogTable,
            boolean keySchemaEnable,
            boolean valueSchemaEnable,
            boolean failOnMissingField,
            boolean ignoreParseErrors) {
        this.catalogTable = catalogTable;
        this.seaTunnelRowType = catalogTable.getSeaTunnelRowType();
        this.keySchemaEnable = keySchemaEnable;
        this.valueSchemaEnable = valueSchemaEnable;
        // Runtime converter
        this.runtimeConverter =
                new JsonToRowConverters(failOnMissingField, ignoreParseErrors)
                        .createRowConverter(checkNotNull(seaTunnelRowType));
    }

    @Override
    public SeaTunnelRow deserialize(byte[] message) throws IOException {
        throw new UnsupportedOperationException(
                "Please invoke DeserializationSchema#deserialize(byte[], Collector<SeaTunnelRow>) instead.");
    }

    /**
     * Deserialize kafka consumer record
     *
     * @param msg
     * @param out
     * @throws Exception
     */
    public void deserialize(ConsumerRecord<byte[], byte[]> msg, Collector<SeaTunnelRow> out)
            throws InvocationTargetException, IllegalAccessException {
        tryInitConverter();
        if (msg == null) {
            return;
        }
        SinkRecord record = convertToSinkRecord(msg);
        RowKind rowKind = RowKind.INSERT;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Call deserialize(byte[] message, Collector<SeaTunnelRow> out) instead, wrapping the raw bytes in a ConsumerRecord if needed.
  2. Use SeaTunnel's Kafka connector which routes through deserialize(SourceRecord/ConsumerRecord, Collector), not the byte[] API.
  3. If you only have raw bytes, construct a ConsumerRecord with a null key/schema and pass it to deserialize.

Example fix

// before
SeaTunnelRow row = schema.deserialize(message);
// after
schema.deserialize(message, new CollectorToList<>(collector));
Defensive patterns

Strategy: type-guard

Validate before calling

if (schema instanceof CompatibleKafkaConnectDeserializationSchema) { /* must use Collector overload */ }

Type guard

boolean needsCollectorOverload = schema instanceof CompatibleKafkaConnectDeserializationSchema;

Try / catch

try { schema.deserialize(msg, collector); } catch (UnsupportedOperationException e) { /* fall back to record-based path */ }

Prevention

When it happens

Trigger: Calling schema.deserialize(message) directly, or plugging this schema into a connector/framework that invokes the byte[]-only DeserializationSchema API instead of the Collector overload.

Common situations: Custom Kafka source code calling the wrong overload in tests; a connector version that still uses the old DeserializationSchema contract; unit tests copied from plain-JSON-format examples.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/042202541b764de4. Report an issue: GitHub.