{"record":{"id":"f6bdd73e84a43119","repo":"apache/beam","slug":"unexpected-marshalling-type-awstype","errorCode":null,"errorMessage":"Unexpected marshalling type awsType","messagePattern":"Unexpected marshalling type awsType","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/schemas/AwsTypes.java","lineNumber":183,"sourceCode":"    SerializableFunction create(SdkField<?> field) {\n      return create(IDENTITY, field);\n    }\n\n    SerializableFunction create(SerializableFunction fn, SdkField<?> field) {\n      MarshallingType<?> awsType = field.marshallingType();\n      SerializableFunction converter;\n      if (awsType == SDK_POJO) {\n        converter = pojoTypeConverter(field);\n      } else if (awsType == INSTANT) {\n        converter = instantConverter;\n      } else if (awsType == SDK_BYTES) {\n        converter = bytesConverter;\n      } else if (awsType == LIST) {\n        converter = transformList(create(elementField(field)));\n      } else if (awsType == MAP) {\n        converter = transformMap(create(valueField(field)));\n      } else {\n        throw new IllegalStateException(\"Unexpected marshalling type \" + awsType);\n      }\n      return fn != IDENTITY ? andThen(fn, nullSafe(converter)) : nullSafe(converter);\n    }\n\n    boolean needsConversion(SdkField<?> field) {\n      MarshallingType<?> type = field.marshallingType();\n      return (convertPojoType && type.equals(MarshallingType.SDK_POJO))\n          || type.equals(INSTANT)\n          || type.equals(SDK_BYTES)\n          || (type.equals(MAP) && needsConversion(valueField(field)))\n          || (type.equals(LIST) && needsConversion(elementField(field)));\n    }\n\n    @SuppressWarnings(\"nullness\")\n    private static SerializableFunction andThen(\n        SerializableFunction fn1, SerializableFunction fn2) {\n      return v -> fn2.apply(fn1.apply(v));\n    }","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/schemas/AwsTypes.java#L165-L201","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nRow row = rowForAwsModel(pojoWithDocumentField);\n// after\nMyPojo trimmed = pojoWithDocumentField.toBuilder()\n    .clearDocumentField()\n    .build();\nRow row = rowForAwsModel(trimmed); // only supported marshalling types","handlingStrategy":"validation","validationCode":"MarshallingType<?> t = field.marshallingType(); if (needsConversion(field) && !SUPPORTED.contains(t)) { /* skip or map manually */ }","typeGuard":null,"tryCatchPattern":"try { row = rowFor(pojo); } catch (IllegalStateException e) { /* fall back to field-by-field manual conversion */ }","preventionTips":["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"],"tags":["java","schemas","type-mapping"],"backgroundTag":"unsupported-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}