apache/beam · error · IllegalArgumentException
Unsupported type
Error message
Unsupported type ${fieldType} What it means
The default branch of the TypeName switch in AvroUtils.genericFromBeamField: the Beam field's TypeName is one the Beam-to-Avro converter does not handle. Only BYTE/INT16/INT32/INT64/FLOAT/DOUBLE/BOOLEAN/STRING/DECIMAL/DATETIME/BYTES/LOGICAL_TYPE/ARRAY/ITERABLE/MAP/ROW are supported; any other Beam type reaching this converter triggers the error.
Solutions
- Upgrade the Beam SDK so the avro extension supports the TypeName
- Convert the unsupported field to a supported representation (e.g. STRING) before writing to Avro
- Regenerate the Avro schema from the Beam schema via AvroUtils.toAvroSchema and confirm all field types map cleanly
- If the type is truly unsupported, file/report upstream and restructure the schema to avoid it
Example fix
// before
row = row.withValue("payload", someUnsupportedObject);
// after
row = row.withValue("payload", someUnsupportedObject.toString()); // STRING is supported Defensive patterns
Strategy: validation
Validate before calling
java.util.Set<String> SUPPORTED = java.util.Set.of("BYTE","INT16","INT32","INT64","FLOAT","DOUBLE","BOOLEAN","STRING","DECIMAL","DATETIME","BYTES","LOGICAL_TYPE","ARRAY","ITERABLE","MAP","ROW");
for (Schema.Field f : beamSchema.getFields()) {
if (!SUPPORTED.contains(f.getType().getTypeName().name()))
throw new IllegalStateException("Unsupported Beam type for Avro: " + f.getType().getTypeName());
} Try / catch
try {
GenericRecord record = AvroUtils.toGenericRecord(row, avroSchema);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Unsupported type")) {
throw new IllegalStateException("Beam schema contains a type not convertible to Avro", e);
} else { throw e; }
} Prevention
- Validate the Beam schema against the supported TypeName list before pipeline launch
- Keep Beam SDK versions consistent across modules so newly added types are handled
- Prefer well-supported primitive/collection/ROW types in schemas written to Avro
When it happens
Trigger: Calling toGenericRecord / toAvroType with a Beam schema containing an unsupported TypeName (e.g. some specialized or newly added Beam types not yet mapped in this Avro extension).
Common situations: Using a Beam type added in a recent SDK release with an older avro extension on the classpath; exotic schema fields produced programmatically; type drift between the Beam schema used to build Rows and the converter's supported set.
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
- Can't represent as
- FieldType and AVRO schema don't have matching nullability
- Incorrectly sized byte array.
- Converting BigQuery type '' to '' is not supported
- Unexpected Avro field schema type
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/74bd86ad1b4396b2.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java:1436
case MAP:
Map<Object, @Nullable Object> map = Maps.newHashMap();
Map<Object, Object> valueMap = (Map<Object, Object>) value;
for (Map.Entry entry : valueMap.entrySet()) {
Utf8 key = new Utf8((String) checkNotNull(entry.getKey()));
map.put(
key,
genericFromBeamField(
checkNotNull(fieldType.getMapValueType()),
typeWithNullability.type.getValueType(),
entry.getValue()));
}
return map;
case ROW:
return toGenericRecord((Row) value, typeWithNullability.type);
default:
throw new IllegalArgumentException("Unsupported type " + fieldType);
}
}
private static Object convertLogicalType(
@PolyNull Object value,
@Nonnull org.apache.avro.Schema avroSchema,
@Nonnull FieldType fieldType,
@Nonnull GenericData genericData) {
TypeWithNullability type = new TypeWithNullability(avroSchema);
// TODO: Remove this workaround once Avro is upgraded to 1.12+ where timestamp-nanos
if (TIMESTAMP_NANOS_LOGICAL_TYPE.equals(type.type.getProp("logicalType"))) {
if (type.type.getType() == org.apache.avro.Schema.Type.LONG) {
Long nanos = (Long) value;
// Check if Beam expects Timestamp logical type
if (fieldType.getTypeName() == TypeName.LOGICAL_TYPE
&& org.apache.beam.sdk.schemas.logicaltypes.Timestamp.IDENTIFIER.equals(
fieldType.getLogicalType().getIdentifier())) {View on GitHub (pinned to 12126d8942)