{"record":{"id":"61b32cf15ca43cf6","repo":"apache/beam","slug":"unsupported-thrift-type-code-s","errorCode":null,"errorMessage":"Unsupported thrift type code: %s","messagePattern":"Unsupported thrift type code: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/thrift/src/main/java/org/apache/beam/sdk/io/thrift/ThriftSchema.java","lineNumber":382,"sourceCode":"        final FieldValueMetaData listElemMetadata = ((ListMetaData) metadata).elemMetaData;\n        return FieldType.array(beamType(listElemMetadata));\n      case TType.MAP:\n        final MapMetaData mapMetadata = ((MapMetaData) metadata);\n        return FieldType.map(\n            beamType(mapMetadata.keyMetaData), beamType(mapMetadata.valueMetaData));\n      case TType.STRUCT:\n        final StructMetaData structMetadata = ((StructMetaData) metadata);\n        return FieldType.row(schemaFor(structMetadata.structClass));\n      case TType.ENUM:\n        @SuppressWarnings(\"unchecked\")\n        final Class<EnumT> enumClass = (Class<EnumT>) ((EnumMetaData) metadata).enumClass;\n        @SuppressWarnings(\"nullness\") // it's either \"nullness\" or \"unsafe\", apparently\n        final EnumT @NonNull [] enumConstants = enumClass.getEnumConstants();\n        final String[] enumValues =\n            Stream.of(enumConstants).map(EnumT::name).toArray(String[]::new);\n        return FieldType.logicalType(EnumerationType.create(enumValues));\n      default:\n        throw new IllegalArgumentException(\"Unsupported thrift type code: \" + metadata.type);\n    }\n  }\n\n  private static class FieldExtractor<FieldT extends TFieldIdEnum, T extends @NonNull Object>\n      implements FieldValueGetter<T, Object> {\n    private final FieldT field;\n\n    private FieldExtractor(FieldT field) {\n      this.field = field;\n    }\n\n    @Override\n    public @Nullable Object get(T thrift) {\n      TBase<?, TFieldIdEnum> t = (TBase<?, TFieldIdEnum>) thrift;\n      if (!(thrift instanceof TUnion) || t.isSet(field)) {\n        final Object value = t.getFieldValue(field);\n        if (value instanceof Enum<?>) {\n          return ((Enum<?>) value).ordinal();","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/thrift/src/main/java/org/apache/beam/sdk/io/thrift/ThriftSchema.java#L364-L400","documentation":"ThriftSchema.beamType maps Thrift field type codes (from TType / thrift metadata) to Beam Schema FieldTypes. When it encounters a Thrift type code it has no mapping for (hits the default branch of its switch), it throws this IllegalArgumentException. It means the Thrift struct being converted uses a type the Beam Thrift schema translation does not support.","triggerScenarios":"Calling ThriftSchema.beamType (directly or via type/beamType inference, e.g. when using thriftToRow conversions or Schema inference on a Thrift class) with a field whose Thrift type code has no case in the switch, such as unusual or newer thrift container types.","commonSituations":"Users serializing Thrift structs containing field types not covered by the mapper (e.g. UUID fields, custom thrift types) into Beam Rows; upgrades of the thrift library introduce type codes Beam does not recognize.","solutions":["Identify the offending field's Thrift type from the message and change the struct to use a supported type (e.g. standard list/set/map/string/i32).","Add or extend a mapping case in ThrriftSchema.beamType for the missing type code and rebuild.","Annotate or exclude unsupported fields from schema conversion (e.g. mark them transient/ignored) if they are not needed in the PCollection schema."],"exampleFix":"// before (struct field unsupported)\noptional uuid myId;\n// after\noptional string myId;","handlingStrategy":"validation","validationCode":"for (TFieldIdEnum f : supportedFields) {\n  checkSupportedType(structMetaData.fieldMetaData.get(f.getThriftFieldId()).typeMetaData.type);\n}","typeGuard":"boolean isSupportedThriftType(byte typeCode) { return Set.of(TType.STOP,TType.BOOL,TType.BYTE,TType.DOUBLE,TType.I16,TType.I32,TType.I64,TType.STRING,TType.STRUCT,TType.MAP,TType.SET,TType.LIST).contains(typeCode); }","tryCatchPattern":"try { Schema schema = ThriftSchema.beamType(clazz); } catch (IllegalArgumentException e) { LOG.error(\"Thrift type unsupported: {}\", e.getMessage()); throw new IllegalStateException(\"Pre-validation failed\", e); }","preventionTips":["Restrict Thrift structs used with Beam schemas to basic TType codes.","Pre-validate thrift IDLs for exotic types (uuid, custom) before wiring them into pipelines.","Pin thrift library versions tested against your Beam version."],"tags":["java","apache-beam","thrift","schema-conversion"],"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"}