apache/seatunnel · error · UnsupportedOperationException

Unsupported BYTES value type: ${value.getClass().getSimpleNa

Error message

Unsupported BYTES value type: ${value.getClass().getSimpleName()}

What it means

convertToBinary handles BYTES columns accepting byte[], and ByteBuffer; any other object type raises UnsupportedOperationException with the value's simple class name. It exists because TiDB CDC payloads can carry binary data in several container types.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-tidb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/tidb/source/converter/DefaultDataConverter.java:246

        String[] array = ((String) value).split(",");
        if (array == null) {
            return null;
        }
        return array;
    }

    private static Object convertToBinary(Object value) {
        if (value instanceof byte[]) {
            return value;
        } else if (value instanceof String) {
            return ((String) value).getBytes();
        } else if (value instanceof ByteBuffer) {
            ByteBuffer byteBuffer = (ByteBuffer) value;
            byte[] bytes = new byte[byteBuffer.remaining()];
            byteBuffer.get(bytes);
            return bytes;
        } else {
            throw new UnsupportedOperationException(
                    "Unsupported BYTES value type: " + value.getClass().getSimpleName());
        }
    }

    private static Object convertToString(Object value) {
        if (value instanceof byte[]) {
            return new String((byte[]) value);
        }
        return value;
    }

    private static Object convertToDate(Object value) {
        return TemporalConversions.toLocalDate(value);
    }

    private static Object convertToTime(Object value) {
        if (value instanceof Long) {
            return LocalTime.ofNanoOfDay((Long) value);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check which class the TiDB CDC version emits for binary values and add a branch for it (e.g. decode base64 Strings)
  2. Verify column type mapping — a string value in a BYTES slot usually means the schema is wrong
  3. Upgrade/align SeaTunnel connector-cdc-tidb and TiDB CDC versions so types agree
  4. If base64, decode before handing to the converter

Example fix

// before
} else {
    throw new UnsupportedOperationException(...);
}
// after
} else if (value instanceof String) {
    return Base64.getDecoder().decode((String) value);
} else {
    throw new UnsupportedOperationException(...);
}
Defensive patterns

Strategy: type-guard

Validate before calling

static boolean isBytesConvertible(Object v) {
    return v instanceof byte[] || v instanceof ByteBuffer || v instanceof String;
}

Type guard

static byte[] asBytes(Object v) {
    if (v instanceof byte[]) return (byte[]) v;
    if (v instanceof ByteBuffer) {
        ByteBuffer b = (ByteBuffer) v.duplicate();
        byte[] out = new byte[b.remaining()]; b.get(out); return out;
    }
    if (v instanceof String) return Base64.getDecoder().decode((String) v);
    return null;
}

Try / catch

try {
    return convertToBinary(value);
} catch (UnsupportedOperationException e) {
    log.error("BYTES column got unexpected type {}", value.getClass());
    throw e;
}

Prevention

When it happens

Trigger: A BLOB/BINARY column whose value arrives as a String, ByteArray, netty ByteBuf, or other non-byte[]/ByteBuffer type inside convert().

Common situations: TiDB CDC emitting binary columns as base64 strings after a version change; schema incorrectly mapped so a VARCHAR value lands in a BYTES column.

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/c6b2b1078ef9b812. Report an issue: GitHub.