{"record":{"id":"a19ab98fa320784b","repo":"apache/seatunnel","slug":"unsupported-data-type-a19ab9","errorCode":"UNSUPPORTED_DATA_TYPE","errorMessage":"SeaTunnel protobuf format is not supported for this data type [%s]","messagePattern":"SeaTunnel protobuf format is not supported for this data type \\[(.+?)\\]","errorType":"error_code","errorClass":"SeaTunnelProtobufFormatException","httpStatus":null,"severity":"error","filePath":"seatunnel-formats/seatunnel-format-protobuf/src/main/java/org/apache/seatunnel/format/protobuf/RowToProtobufConverter.java","lineNumber":101,"sourceCode":"            case BOOLEAN:\n            case DECIMAL:\n            case DATE:\n            case TIMESTAMP:\n            case BYTES:\n                return data;\n            case TINYINT:\n                if (data instanceof Byte) {\n                    return Byte.toUnsignedInt((Byte) data);\n                }\n                return data;\n            case MAP:\n                return handleMapType(fieldName, data, seaTunnelDataType, builder);\n            case ARRAY:\n                return Arrays.asList((Object[]) data);\n            case ROW:\n                return handleRowType(fieldName, data, seaTunnelDataType);\n            default:\n                throw new SeaTunnelProtobufFormatException(\n                        ProtobufFormatErrorCode.UNSUPPORTED_DATA_TYPE,\n                        String.format(\n                                \"SeaTunnel protobuf format is not supported for this data type [%s]\",\n                                seaTunnelDataType.getSqlType()));\n        }\n    }\n\n    private Object handleMapType(\n            String fieldName,\n            Object data,\n            SeaTunnelDataType<?> seaTunnelDataType,\n            DynamicMessage.Builder builder) {\n        Descriptors.Descriptor mapEntryDescriptor =\n                descriptor.findFieldByName(fieldName).getMessageType();\n\n        if (data instanceof Map) {\n            Map<?, ?> mapData = (Map<?, ?>) data;\n            mapData.forEach(","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-protobuf/src/main/java/org/apache/seatunnel/format/protobuf/RowToProtobufConverter.java#L83-L119","documentation":"Thrown by RowToProtobufConverter.resolveObject when converting a SeaTunnelRow field value into a protobuf message field whose SeaTunnel type is not supported for the write direction. Handled cases include maps, arrays and rows; other types hit the default branch and throw SeaTunnelProtobufFormatException with UNSUPPORTED_DATA_TYPE.","triggerScenarios":"resolvedValue -> resolveObject receiving a field whose seaTunnelDataType is neither a protobuf-mappable primitive/string/bytes/temporal nor MAP/ARRAY/ROW (e.g. unsupported composite or null-like types) while writing rows to protobuf format.","commonSituations":"Sink catalog columns typed with types the protobuf writer cannot represent; mismatch between the declared schema and the actual proto descriptor; using the protobuf format for data types introduced after the converter was written.","solutions":["Align the sink schema so the field uses a type protobuf supports (scalar, STRING, BYTES, temporal, MAP, ARRAY, ROW)","Restructure the SeaTunnelRow so unsupported types are encoded as supported ones (e.g. converted to STRING) in an upstream transform","Check the SeaTunnel version for extended protobuf type support and upgrade if available"],"exampleFix":"// before\n// schema column typed with unsupported type passed straight to protobuf sink\n\n// after\n// in an upstream transform:\nrow.setField(idx, String.valueOf(unsupportedValue)); // encode as STRING","handlingStrategy":"validation","validationCode":"if (type.getSqlType() != SqlType.MAP && type.getSqlType() != SqlType.ARRAY\n    && type.getSqlType() != SqlType.ROW && !isScalarSupported(type.getSqlType())) {\n    throw new IllegalArgumentException(\"Unsupported row->proto type: \" + type);\n}","typeGuard":"boolean isWritableToProtobuf(SeaTunnelDataType<?> t) {\n    switch (t.getSqlType()) {\n        case MAP: case ARRAY: case ROW: return true;\n        default: return isScalarSupported(t.getSqlType());\n    }\n}","tryCatchPattern":"try {\n    builder = rowToProtobufConverter.resolvedValue(fieldName, data, type, builder);\n} catch (SeaTunnelProtobufFormatException e) {\n    log.error(\"Cannot encode field {} as protobuf type {}\", fieldName, type, e);\n    throw e;\n}","preventionTips":["Keep sink schemas within protobuf-mappable types","Encode exotic fields as STRING in an upstream transform","Validate the row schema against the proto descriptor at job startup in tests"],"tags":["protobuf","serialization","data-type"],"backgroundTag":"unsupported-dtype","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"}