apache/seatunnel · error · UnsupportedOperationException
Unsupported convert %s to Map, typeDefine: %s
Error message
Unsupported convert %s to Map, typeDefine: %s
What it means
The default convertMap implementation accepts only java.util.Map instances; anything else triggers this UnsupportedOperationException. The typeDefine (MapType) is included to show which map schema was expected. It fires when a value routed to the MAP conversion path is not a Map at runtime.
Source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:158
default:
throw new UnsupportedOperationException(
"Unsupported convert "
+ value.getClass()
+ " to "
+ columnDefine.getDataType().getSqlType());
}
}
default Map convertMap(T typeDefine, Column columnDefine, Object value)
throws UnsupportedOperationException {
return convertMap((MapType) columnDefine.getDataType(), value);
}
default Map convertMap(MapType typeDefine, Object value) throws UnsupportedOperationException {
if (value instanceof Map) {
return (Map) value;
}
throw new UnsupportedOperationException(
"Unsupported convert " + value.getClass() + " to Map, typeDefine: " + typeDefine);
}
default Object[] convertArray(T typeDefine, Column columnDefine, Object value)
throws UnsupportedOperationException {
return convertArray((ArrayType) columnDefine.getDataType(), value);
}
default Object[] convertArray(ArrayType typeDefine, Object value)
throws UnsupportedOperationException {
if (value.getClass().isArray()) {
SeaTunnelDataType elementType = typeDefine.getElementType();
Object[] array = (Object[]) value;
for (int i = 0; i < array.length; i++) {
array[i] = convert(elementType, array[i]);
}
return array;View on GitHub (pinned to cf67b549a7)
Solutions
- Parse or convert the value to a java.util.Map before handing it to the converter (e.g. with Jackson for JSON strings).
- If the value is a List of pairs, transform it into a LinkedHashMap manually.
- Override convertMap in your converter subclass to accept the actual runtime type.
- Verify the column SqlType is MAP; if the data is really a string, change the schema instead.
Example fix
// before
converter.convertMap(mapType, jsonString);
// after
Map<String, Object> map = new ObjectMapper().readValue(jsonString, new TypeReference<Map<String, Object>>() {});
converter.convertMap(mapType, map); Defensive patterns
Strategy: type-guard
Validate before calling
if (!(value instanceof Map)) {
throw new IllegalArgumentException("convertMap expects java.util.Map, got " + value.getClass());
} Type guard
boolean isMapValue(Object value) { return value instanceof Map; } Try / catch
try {
return converter.convertMap(mapType, value);
} catch (UnsupportedOperationException e) {
LOG.warn("Not a Map: {}", e.getMessage());
return Collections.emptyMap();
} Prevention
- Parse JSON strings into Map before conversion.
- Wrap list-of-pairs into LinkedHashMap manually.
- Check driver return types: some NoSQL drivers return custom document objects, adapt them to java.util.Map.
- Validate the column SqlType is actually MAP.
When it happens
Trigger: Calling convertMap(typeDefine, value) directly, or convert(...) with a MAP SqlType column, when value is a List, POJO, JSON string, or other non-Map object.
Common situations: Passing a JSON string that was never parsed into a Map; passing a List of key-value pairs hoping the converter will zip them; upstream framework (e.g. a NoSQL driver) returning its own document type not extending java.util.Map.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Unsupported convert %s to Array, typeDefine: %s
- Unsupported convert ${value.getClass()} to Row, typeDefine:
- Unsupported convert ${value.getClass()} to byte[], typeDefin
- Unsupported convert ${value.getClass()} to byte[]
- Unsupported convert ${value.getClass()} to LocalDateTime, ty
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/5b9ec0fe3b44ab98.
Report an issue: GitHub.