apache/beam · error · IllegalArgumentException
Unsupported field type: {type}
Error message
Unsupported field type: {type} What it means
RowJson's serializer (RowJsonCreator's generator) writes Row fields by schema type and handles only a fixed set of types in its switch. Encountering an unsupported Schema.Type in writeValue throws IllegalArgumentException 'Unsupported field type'.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java:617
gen.writeFieldName(entry.getKey().toString());
writeValue(gen, type.getMapValueType(), entry.getValue());
}
gen.writeEndObject();
break;
case LOGICAL_TYPE:
String identifier = type.getLogicalType().getIdentifier();
if (SqlTypes.DATE.getIdentifier().equals(identifier)) {
gen.writeString(((LocalDate) value).toString()); // ISO 8601 format
} else if (SqlTypes.TIME.getIdentifier().equals(identifier)) {
gen.writeString(((LocalTime) value).toString()); // ISO 8601 format
} else if (SqlTypes.DATETIME.getIdentifier().equals(identifier)) {
gen.writeString(((LocalDateTime) value).toString()); // ISO 8601 format
} else {
writeValue(gen, type.getLogicalType().getBaseType(), value);
}
break;
default:
throw new IllegalArgumentException("Unsupported field type: " + type);
}
}
}
/** Gets thrown when Row parsing or serialization fails for any reason. */
public static class UnsupportedRowJsonException extends RuntimeException {
UnsupportedRowJsonException(String message, Throwable reason) {
super(message, reason);
}
UnsupportedRowJsonException(String message) {
super(message);
}
}
}
View on GitHub (pinned to 12126d8942)
Solutions
- Check the switch in RowJson.RowWriter.writeValue and only serialize supported types
- Convert unsupported fields to supported types (e.g. logical type to its base type or String) before serialization
- Register/handle the logical type explicitly, or flatten the schema
- Catch IllegalArgumentException around rowToJson to handle offending rows
Example fix
// before: field of unsupported logical type serialized directly
rowToJson(mapper, rowWithCustomLogicalType);
// after: convert to base type/string first
Row fixed = rowFrom(ROW_SCHEMA).withFieldValue("ts", ts.toString()).build();
rowToJson(mapper, fixed); Defensive patterns
Strategy: try-catch
Validate before calling
boolean allSupported = row.getSchema().getFields().stream()
.allMatch(f -> SUPPORTED_WRITER_TYPES.contains(f.getType().getTypeName()));
if (!allSupported) { /* convert or skip row */ } Try / catch
try { String s = RowJsonUtils.rowToJson(mapper, row); } catch (IllegalArgumentException e) { /* row contains unsupported field type */ } Prevention
- Check the writeValue switch for supported Schema.Types before serializing
- Convert custom/logical types to base types or strings
- Add serialization smoke tests for evolving schemas
When it happens
Trigger: Serializing a Row (RowJsonUtils.rowToJson or objectMapper.writeValueAsString on a Row) whose schema contains a field type not covered by the writer's switch (e.g. certain logical or nested types it does not handle directly).
Common situations: Rows built with logical types or newer Beam types not yet supported by the JSON writer; schema evolution introduced an exotic type; custom logical types.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unable to serialize row: {row}
- Cannot provide SerializableCoder because {} does not impleme
- Java Serialization may be non-deterministic.
- cannot encode a null String
- cannot encode a null Integer
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/ca15c37b30275485.
Report an issue: GitHub.