apache/seatunnel · error · IllegalArgumentException
Unsupported MQTT sink format:
Error message
Unsupported MQTT sink format:
What it means
Thrown by createSerializationSchema in MqttSinkWriter when the configured sink 'format' does not match any supported serialization schema (e.g. json/text). Only formats with a builder case in the switch are accepted. IllegalArgumentException means the config value is not part of the supported set.
Source
Thrown at seatunnel-connectors-v2/connector-mqtt/src/main/java/org/apache/seatunnel/connectors/seatunnel/mqtt/sink/MqttSinkWriter.java:254
options.setPassword(password.toCharArray());
}
return options;
}
private static SerializationSchema createSerializationSchema(
SeaTunnelRowType rowType, ReadonlyConfig config) {
String format = config.get(MqttSinkOptions.FORMAT);
switch (format.toLowerCase()) {
case "json":
return new JsonSerializationSchema(rowType);
case "text":
String delimiter = config.get(MqttSinkOptions.FIELD_DELIMITER);
return TextSerializationSchema.builder()
.seaTunnelRowType(rowType)
.delimiter(delimiter)
.build();
default:
throw new IllegalArgumentException("Unsupported MQTT sink format: " + format);
}
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Set format to one of the supported sink values exactly as handled in MqttSinkWriter (e.g. json, text)
- Check docs/en for connector-mqtt sink format options and allowed values
- Fix typos and match casing exactly as the option expects
- If you need a new format, add a case in createSerializationSchema with the appropriate schema builder
Example fix
// before format = csv // after format = text # or format = json
Defensive patterns
Strategy: validation
Validate before calling
Set<String> supported = Set.of("json", "text");
if (!supported.contains(format.trim().toLowerCase())) {
throw new IllegalArgumentException("Unsupported MQTT sink format: " + format);
} Type guard
null
Try / catch
null
Prevention
- Validate format values against docs before submitting the job config
- Use config templates with a fixed enum of allowed formats
- Add a unit test asserting supported format values in MqttSinkWriter
When it happens
Trigger: Setting format in the MQTT sink config to a value other than those handled by the switch (default branch reached), causing MqttSinkWriter construction to fail immediately.
Common situations: Typo in format (e.g. 'jsonl', 'csv'); copying a format value valid for other connectors; casing assumptions — the sink switch may be case-sensitive even when docs show lowercase.
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
- Unsupported MQTT source format: ${format}
- UNSUPPORTED_DATA_TYPE
- UNSUPPORTED_DATA_TYPE
- Invalid endpoint: %s, expected format host:port
- Invalid endpoint port in endpoint: %s
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/b61e7aea76e95719.
Report an issue: GitHub.