apache/seatunnel · error · IllegalArgumentException
Unknown format type:
Error message
Unknown format type:
What it means
DataFormatType.fromString maps a user-supplied format string (e.g. json, string) to the DataFormatType enum by case-insensitive comparison; if no enum constant matches it throws IllegalArgumentException 'Unknown format type: <format>'. It guards the aerospike connector against misspelled format config values.
Source
Thrown at seatunnel-connectors-v2/connector-aerospike/src/main/java/org/apache/seatunnel/connectors/seatunnel/aerospike/config/DataFormatType.java:42
@Getter
public enum DataFormatType implements Serializable {
MAP("map"),
STRING("string"),
KV("kv");
private final String format;
DataFormatType(String format) {
this.format = format;
}
public static DataFormatType fromString(String format) {
for (DataFormatType type : DataFormatType.values()) {
if (type.format.equalsIgnoreCase(format)) {
return type;
}
}
throw new IllegalArgumentException("Unknown format type: " + format);
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Check the configured format value and correct it to a supported one (json or string, per DataFormatType)
- Trim whitespace from the config value
- Consult the aerospike connector docs for the allowed format options
- Add a new enum constant + parsing branch if a new format is genuinely needed
Example fix
// before format = csv // after format = json
Defensive patterns
Strategy: validation
Validate before calling
Set<String> allowed = Set.of("json", "string");
if (!allowed.contains(format.trim().toLowerCase())) throw new IllegalArgumentException("format must be one of " + allowed); Type guard
boolean isValidFormat(String f) { return f != null && ("json".equalsIgnoreCase(f.trim()) || "string".equalsIgnoreCase(f.trim())); } Try / catch
try { type = DataFormatType.fromString(format); } catch (IllegalArgumentException e) { /* default to JSON or surface a clear config error */ type = DataFormatType.JSON; } Prevention
- Copy format values exactly from the aerospike connector docs
- Trim whitespace from config values
- Add a config pre-check in CI for allowed enum values
- Prefer lowercase canonical values even though comparison is case-insensitive
When it happens
Trigger: Setting the aerospike source/sink 'format' option to a value not in the enum (anything other than the supported JSON/STRING values), which is then passed to DataFormatType.fromString.
Common situations: Typo like 'JSON ' with whitespace, 'jsonline', 'csv', or a format copied from another connector's docs; case is tolerated but spelling is not.
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
- Unknown ftp connection mode: ${mode}
- input.on-error must be "skip" or "fail".
- input.multiline.match must be "after" or "before".
- input.output-format.type must be "line" or "json".
- Unsupported agent.delivery-guarantee: ${value}. Supported: B
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/f015b56cd155c77d.
Report an issue: GitHub.