apache/beam · error · IllegalStateException
Unexpected marshalling type awsType
Error message
Unexpected marshalling type awsType
What it means
AwsTypes' converter factory (create) switches on an SdkField's MarshallingType and throws IllegalStateException 'Unexpected marshalling type <type>' when the field's marshalling type has no converter. Reached from fieldValueGetters and recursive create calls when converting AWS POJO values to Beam Row values.
Solutions
- Upgrade Beam to a version whose converter handles the marshalling type
- Verify AWS SDK v2 and Beam AWS2 module versions are aligned
- Avoid the offending field by mapping only supported fields
Example fix
// before
Row row = rowForAwsModel(pojoWithDocumentField);
// after
MyPojo trimmed = pojoWithDocumentField.toBuilder()
.clearDocumentField()
.build();
Row row = rowForAwsModel(trimmed); // only supported marshalling types Defensive patterns
Strategy: validation
Validate before calling
MarshallingType<?> t = field.marshallingType(); if (needsConversion(field) && !SUPPORTED.contains(t)) { /* skip or map manually */ } Try / catch
try { row = rowFor(pojo); } catch (IllegalStateException e) { /* fall back to field-by-field manual conversion */ } Prevention
- Avoid AWS POJO fields with exotic marshalling types (e.g. document/blob streaming)
- Upgrade Beam when AWS SDK adds new marshalling types
- Run small conversion tests before full pipeline deployment
When it happens
Trigger: Converting an AWS SDK POJO to a Beam Row where a field's marshalling type is neither scalar (string/int/etc.), LIST, MAP, nor another supported type; nested fields recursively hitting the same branch.
Common situations: Version skew: AWS SDK added a new MarshallingType (e.g. for document types) that the Beam converter doesn't know; using AwsSchemaProvider on POJOs with exotic field types.
Related errors
- Type of field is unknown.
- Array schema is not properly formatted or unsupported
- Cannot select a subfield of a non-composite type.
- Could not infer beam type for thrift field
- Field type not matched.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/f6bdd73e84a43119.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/schemas/AwsTypes.java:183
SerializableFunction create(SdkField<?> field) {
return create(IDENTITY, field);
}
SerializableFunction create(SerializableFunction fn, SdkField<?> field) {
MarshallingType<?> awsType = field.marshallingType();
SerializableFunction converter;
if (awsType == SDK_POJO) {
converter = pojoTypeConverter(field);
} else if (awsType == INSTANT) {
converter = instantConverter;
} else if (awsType == SDK_BYTES) {
converter = bytesConverter;
} else if (awsType == LIST) {
converter = transformList(create(elementField(field)));
} else if (awsType == MAP) {
converter = transformMap(create(valueField(field)));
} else {
throw new IllegalStateException("Unexpected marshalling type " + awsType);
}
return fn != IDENTITY ? andThen(fn, nullSafe(converter)) : nullSafe(converter);
}
boolean needsConversion(SdkField<?> field) {
MarshallingType<?> type = field.marshallingType();
return (convertPojoType && type.equals(MarshallingType.SDK_POJO))
|| type.equals(INSTANT)
|| type.equals(SDK_BYTES)
|| (type.equals(MAP) && needsConversion(valueField(field)))
|| (type.equals(LIST) && needsConversion(elementField(field)));
}
@SuppressWarnings("nullness")
private static SerializableFunction andThen(
SerializableFunction fn1, SerializableFunction fn2) {
return v -> fn2.apply(fn1.apply(v));
}View on GitHub (pinned to 12126d8942)