apache/beam · error · UnsupportedRowJsonException
Field type%s %s not supported when converting between JSON a
Error message
Field type%s %s not supported when converting between JSON and Rows. Supported types are: %s
What it means
RowJson.verifySchemaSupported scans a Schema and throws UnsupportedRowJsonException if any field has a type not supported by Beam's Row-to-JSON conversion. The message lists the unsupported fields and the set of supported types. This is a pre-flight validation for JSON serialization of Rows.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java:117
})
public class RowJson {
private static final ImmutableSet<TypeName> SUPPORTED_TYPES =
ImmutableSet.of(
BYTE, INT16, INT32, INT64, FLOAT, DOUBLE, BOOLEAN, STRING, DECIMAL, DATETIME, MAP);
private static final ImmutableSet<String> KNOWN_LOGICAL_TYPE_IDENTIFIERS =
ImmutableSet.of(
SqlTypes.DATE.getIdentifier(),
SqlTypes.TIME.getIdentifier(),
SqlTypes.DATETIME.getIdentifier());
/**
* Throws {@link UnsupportedRowJsonException} if {@code schema} contains an unsupported field
* type.
*/
public static void verifySchemaSupported(Schema schema) {
ImmutableList<UnsupportedField> unsupportedFields = findUnsupportedFields(schema);
if (!unsupportedFields.isEmpty()) {
throw new UnsupportedRowJsonException(
String.format(
"Field type%s %s not supported when converting between JSON and Rows. Supported types are: %s",
unsupportedFields.size() > 1 ? "s" : "",
unsupportedFields.toString(),
SUPPORTED_TYPES.toString()));
}
}
private static class UnsupportedField {
final String descriptor;
final TypeName typeName;
UnsupportedField(String descriptor, TypeName typeName) {
this.descriptor = descriptor;
this.typeName = typeName;
}
@OverrideView on GitHub (pinned to 12126d8942)
Solutions
- Remove or transform unsupported fields (map them to supported types) before JSON conversion.
- Check SUPPORTED_TYPES in RowJson to confirm which field types are allowed.
- Use a logical type with a supported base type or convert to STRING manually.
- Flatten or drop nested unsupported structures before serialization.
Example fix
// before
RowJson.RowToJsonConverter converter = RowJson.RowToJsonConverter.forSchema(schema); // throws
// after
Schema trimmed = schema;
for (UnsupportedField f : RowJson.findUnsupportedFields(schema)) {
trimmed = Schema.builder().addFields(.../* exclude or remap f */...).build();
} Defensive patterns
Strategy: validation
Validate before calling
try {
RowJson.verifySchemaSupported(schema);
} catch (UnsupportedRowJsonException e) {
// remap/drop unsupported fields before building the converter
} Try / catch
try {
converter = RowJson.RowToJsonConverter.forSchema(schema);
} catch (UnsupportedRowJsonException e) {
schema = sanitizeSchema(schema); // remove/remap unsupported field types
converter = RowJson.RowToJsonConverter.forSchema(schema);
} Prevention
- Run verifySchemaSupported as a startup check for any Row<->JSON path.
- Keep schemas limited to types in RowJson.SUPPORTED_TYPES.
- Convert logical/custom types to supported base types (e.g. STRING) at ingest.
- Add a test asserting schema-to-JSON compatibility on schema changes.
When it happens
Trigger: Calling RowJson.toJson / creating a RowJson converter for a schema containing an unsupported field type (per SUPPORTED_TYPES), verified via verifySchemaSupported(schema).
Common situations: Schemas containing logical types, MAP/ARRAY of unsupported element types, or custom types that have no JSON mapping; schema evolved to add such a field after JSON export was built.
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
- Unknown BigQuery type: " + bqType
- Unknown Avro type: " + type.getType()
- Cannot provide a coder for a Beam Row. Please provide a sche
- Found incorrectly annotated property methods, if a method is
- Unable to parse JSON value
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/0cf84e9ec91372be.
Report an issue: GitHub.