{"record":{"id":"c6b2b1078ef9b812","repo":"apache/seatunnel","slug":"unsupported-bytes-value-type-value-getclass-g","errorCode":null,"errorMessage":"Unsupported BYTES value type: ${value.getClass().getSimpleName()}","messagePattern":"Unsupported BYTES value type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-tidb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/tidb/source/converter/DefaultDataConverter.java","lineNumber":246,"sourceCode":"        String[] array = ((String) value).split(\",\");\n        if (array == null) {\n            return null;\n        }\n        return array;\n    }\n\n    private static Object convertToBinary(Object value) {\n        if (value instanceof byte[]) {\n            return value;\n        } else if (value instanceof String) {\n            return ((String) value).getBytes();\n        } else if (value instanceof ByteBuffer) {\n            ByteBuffer byteBuffer = (ByteBuffer) value;\n            byte[] bytes = new byte[byteBuffer.remaining()];\n            byteBuffer.get(bytes);\n            return bytes;\n        } else {\n            throw new UnsupportedOperationException(\n                    \"Unsupported BYTES value type: \" + value.getClass().getSimpleName());\n        }\n    }\n\n    private static Object convertToString(Object value) {\n        if (value instanceof byte[]) {\n            return new String((byte[]) value);\n        }\n        return value;\n    }\n\n    private static Object convertToDate(Object value) {\n        return TemporalConversions.toLocalDate(value);\n    }\n\n    private static Object convertToTime(Object value) {\n        if (value instanceof Long) {\n            return LocalTime.ofNanoOfDay((Long) value);","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-tidb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/tidb/source/converter/DefaultDataConverter.java#L228-L264","documentation":"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.","triggerScenarios":"A BLOB/BINARY column whose value arrives as a String, ByteArray, netty ByteBuf, or other non-byte[]/ByteBuffer type inside convert().","commonSituations":"TiDB CDC emitting binary columns as base64 strings after a version change; schema incorrectly mapped so a VARCHAR value lands in a BYTES column.","solutions":["Check which class the TiDB CDC version emits for binary values and add a branch for it (e.g. decode base64 Strings)","Verify column type mapping — a string value in a BYTES slot usually means the schema is wrong","Upgrade/align SeaTunnel connector-cdc-tidb and TiDB CDC versions so types agree","If base64, decode before handing to the converter"],"exampleFix":"// before\n} else {\n    throw new UnsupportedOperationException(...);\n}\n// after\n} else if (value instanceof String) {\n    return Base64.getDecoder().decode((String) value);\n} else {\n    throw new UnsupportedOperationException(...);\n}","handlingStrategy":"type-guard","validationCode":"static boolean isBytesConvertible(Object v) {\n    return v instanceof byte[] || v instanceof ByteBuffer || v instanceof String;\n}","typeGuard":"static byte[] asBytes(Object v) {\n    if (v instanceof byte[]) return (byte[]) v;\n    if (v instanceof ByteBuffer) {\n        ByteBuffer b = (ByteBuffer) v.duplicate();\n        byte[] out = new byte[b.remaining()]; b.get(out); return out;\n    }\n    if (v instanceof String) return Base64.getDecoder().decode((String) v);\n    return null;\n}","tryCatchPattern":"try {\n    return convertToBinary(value);\n} catch (UnsupportedOperationException e) {\n    log.error(\"BYTES column got unexpected type {}\", value.getClass());\n    throw e;\n}","preventionTips":["Map BLOB/BINARY columns to BYTES in the schema and strings elsewhere","Check the TiDB CDC version's binary value representation","Add coverage for base64-encoded strings if your payload format uses them"],"tags":["tidb","cdc","bytes","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}