{"record":{"id":"74bd86ad1b4396b2","repo":"apache/beam","slug":"unsupported-type-fieldtype","errorCode":null,"errorMessage":"Unsupported type ${fieldType}","messagePattern":"Unsupported type (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java","lineNumber":1436,"sourceCode":"      case MAP:\n        Map<Object, @Nullable Object> map = Maps.newHashMap();\n        Map<Object, Object> valueMap = (Map<Object, Object>) value;\n        for (Map.Entry entry : valueMap.entrySet()) {\n          Utf8 key = new Utf8((String) checkNotNull(entry.getKey()));\n          map.put(\n              key,\n              genericFromBeamField(\n                  checkNotNull(fieldType.getMapValueType()),\n                  typeWithNullability.type.getValueType(),\n                  entry.getValue()));\n        }\n        return map;\n\n      case ROW:\n        return toGenericRecord((Row) value, typeWithNullability.type);\n\n      default:\n        throw new IllegalArgumentException(\"Unsupported type \" + fieldType);\n    }\n  }\n\n  private static Object convertLogicalType(\n      @PolyNull Object value,\n      @Nonnull org.apache.avro.Schema avroSchema,\n      @Nonnull FieldType fieldType,\n      @Nonnull GenericData genericData) {\n    TypeWithNullability type = new TypeWithNullability(avroSchema);\n\n    // TODO: Remove this workaround once Avro is upgraded to 1.12+ where timestamp-nanos\n    if (TIMESTAMP_NANOS_LOGICAL_TYPE.equals(type.type.getProp(\"logicalType\"))) {\n      if (type.type.getType() == org.apache.avro.Schema.Type.LONG) {\n        Long nanos = (Long) value;\n        // Check if Beam expects Timestamp logical type\n        if (fieldType.getTypeName() == TypeName.LOGICAL_TYPE\n            && org.apache.beam.sdk.schemas.logicaltypes.Timestamp.IDENTIFIER.equals(\n                fieldType.getLogicalType().getIdentifier())) {","sourceCodeStart":1418,"sourceCodeEnd":1454,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java#L1418-L1454","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nrow = row.withValue(\"payload\", someUnsupportedObject);\n// after\nrow = row.withValue(\"payload\", someUnsupportedObject.toString()); // STRING is supported","handlingStrategy":"validation","validationCode":"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\");\nfor (Schema.Field f : beamSchema.getFields()) {\n  if (!SUPPORTED.contains(f.getType().getTypeName().name()))\n    throw new IllegalStateException(\"Unsupported Beam type for Avro: \" + f.getType().getTypeName());\n}","typeGuard":null,"tryCatchPattern":"try {\n  GenericRecord record = AvroUtils.toGenericRecord(row, avroSchema);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Unsupported type\")) {\n    throw new IllegalStateException(\"Beam schema contains a type not convertible to Avro\", e);\n  } else { throw e; }\n}","preventionTips":["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"],"tags":["java","avro","beam-schema","unsupported-type","conversion"],"backgroundTag":"type-mismatch","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"}