apache/seatunnel · error · SeaTunnelJsonFormatException
CommonErrorCode.UNSUPPORTED_DATA_TYPE
CommonErrorCode.UNSUPPORTED_DATA_TYPE
Error message
Unsupported format: %s
What it means
PulsarSinkWriter.createSerializationSchema supports a fixed set of value formats; when the configured 'format' matches none of them (and is not the Avro branch), it throws SeaTunnelJsonFormatException with UNSUPPORTED_DATA_TYPE. The format string determines how rows are serialized to bytes before publishing.
Source
Thrown at seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/sink/PulsarSinkWriter.java:288
if (closeFailure != null) {
rethrowCloseFailure(closeFailure);
}
}
private SerializationSchema createSerializationSchema(
SeaTunnelRowType rowType, String format, String delimiter) {
if (PulsarSinkOptions.DEFAULT_FORMAT.equals(format)) {
return new JsonSerializationSchema(rowType);
} else if (PulsarSinkOptions.TEXT_FORMAT.equals(format)) {
return TextSerializationSchema.builder()
.seaTunnelRowType(rowType)
.delimiter(delimiter)
.build();
} else if (PulsarSinkOptions.AVRO_FORMAT.equals(format)) {
return new AvroSerializationSchema(rowType);
} else {
throw new SeaTunnelJsonFormatException(
CommonErrorCode.UNSUPPORTED_DATA_TYPE, "Unsupported format: " + format);
}
}
public static SerializationSchema createKeySerializationSchema(
List<String> keyFieldNames, SeaTunnelRowType seaTunnelRowType) {
if (keyFieldNames == null || keyFieldNames.isEmpty()) {
return null;
}
int[] keyFieldIndexArr = new int[keyFieldNames.size()];
SeaTunnelDataType[] keyFieldDataTypeArr = new SeaTunnelDataType[keyFieldNames.size()];
for (int i = 0; i < keyFieldNames.size(); i++) {
String keyFieldName = keyFieldNames.get(i);
int rowFieldIndex = seaTunnelRowType.indexOf(keyFieldName);
keyFieldIndexArr[i] = rowFieldIndex;
keyFieldDataTypeArr[i] = seaTunnelRowType.getFieldType(rowFieldIndex);
}
SeaTunnelRowType keyType =View on GitHub (pinned to cf67b549a7)
Solutions
- Use one of the supported formats, e.g. 'json', 'text', 'canal-json' or 'avro' (check PulsarSinkOptions/constants for the exact accepted values).
- Fix casing/spelling of the format value in the config.
- Use AvroSerializationSchema by setting format to the Avro option if Avro output is needed.
Example fix
// before
sink {
Pulsar {
format = "parquet"
}
}
// after
sink {
Pulsar {
format = "json"
}
} Defensive patterns
Strategy: validation
Validate before calling
Set<String> supported = Set.of("json", "text", "canal-json", "avro");
if (!supported.contains(format.toLowerCase())) {
throw new IllegalArgumentException("Unsupported Pulsar sink format: " + format);
} Try / catch
try {
schema = PulsarSinkWriter.createSerializationSchema(rowType, format, delimiter);
} catch (SeaTunnelJsonFormatException e) {
log.error("Unsupported format '{}'; use json/text/canal-json/avro", format);
throw e;
} Prevention
- Keep a list of supported Pulsar sink formats handy and validate configs against it.
- Avoid copying 'format' values from other connectors (e.g. parquet).
- Pin format values in shared config templates.
When it happens
Trigger: Setting sink option format (PulsarSinkOptions format) to a value not in the supported switch (e.g. 'parquet', 'protobuf', or a typo like 'jsonn') in createSerializationSchema.
Common situations: Typo in format value; copying a format valid for other connectors (e.g. 'parquet') into the Pulsar sink; case mismatch ('JSON' vs 'json'); upgrading SeaTunnel where an old format alias was removed.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- CommonErrorCode.UNSUPPORTED_DATA_TYPE
- CONFIG_VALIDATION_FAILED
- SERIALIZATION_ERROR
- A decoding format must override this method to apply metadat
- Unsupported type in LocalTimeArrayType: ${eleSqlType}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/46afd5594def64da.
Report an issue: GitHub.