{"record":{"id":"c39ac77e2d62e5fa","repo":"apache/beam","slug":"unsupported-proto-type-javatype","errorCode":null,"errorMessage":"Unsupported proto type: ${javaType}","messagePattern":"Unsupported proto type: (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoBeamConverter.java","lineNumber":266,"sourceCode":"                  .build();\n            };\n          case \"google.protobuf.Duration\":\n            return beam -> {\n              Duration duration = (Duration) beam;\n              return com.google.protobuf.Duration.newBuilder()\n                  .setSeconds(duration.getSeconds())\n                  .setNanos(duration.getNano())\n                  .build();\n            };\n          case \"google.protobuf.Any\":\n            throw new UnsupportedOperationException(\"google.protobuf.Any is not supported\");\n          default:\n            SerializableFunction<Row, Message> converter =\n                toProto(fieldDescriptor.getMessageType());\n            return value -> converter.apply((Row) value);\n        }\n      default:\n        throw new UnsupportedOperationException(\n            \"Unsupported proto type: \" + fieldDescriptor.getJavaType());\n    }\n  }\n\n  /** Gets a converter from non-null Proto value to non-null Beam. */\n  static <ProtoUnwrappedT, BeamT>\n      ProtoToBeamConverter<Object, BeamT> createWrappableProtoToBeamConverter(\n          ProtoToBeamConverter<ProtoUnwrappedT, BeamT> converter) {\n    return protoValue -> {\n      @NonNull ProtoUnwrappedT unwrappedProtoValue;\n      if (protoValue instanceof Message) {\n        // A google protobuf wrapper\n        Message protoWrapper = (Message) protoValue;\n        Descriptors.FieldDescriptor wrapperValueFieldDescriptor =\n            protoWrapper.getDescriptorForType().findFieldByNumber(1);\n        unwrappedProtoValue =\n            (@NonNull ProtoUnwrappedT)\n                Preconditions.checkNotNull(protoWrapper.getField(wrapperValueFieldDescriptor));","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoBeamConverter.java#L248-L284","documentation":"ProtoBeamConverter.createBeamToProtoSingularConverter switches exhaustively over the protobuf FieldDescriptor JavaType and supported descriptor types; any JavaType/descriptor kind it does not recognize (a type with no Beam Row mapping) hits the default branch and throws UnsupportedOperationException naming the proto type.","triggerScenarios":"Calling toProto/createBeamToProtoConverter on a message whose field has a JavaType or descriptor kind outside the implemented switch (e.g. an exotic or newly-added proto type not yet mapped by the Beam protobuf extension).","commonSituations":"Upgrading protobuf and picking up new field kinds the Beam extension predates; custom descriptor setups; message fields whose type resolution falls through to default after other cases (like Any) were handled.","solutions":["Check the field's JavaType/descriptor kind against the switch in ProtoBeamConverter and use a supported type","Replace the offending field type with a supported proto type (message, primitives, map, enum)","Perform an intermediate transformation so the field reaches the converter as a supported type","If the type should be supported, upgrade the Beam SDK to a version that handles it"],"exampleFix":"// before\nmessage M { SomeUnsupportedType f = 1; }\n// after\nmessage M { string f = 1; } // map to a supported Beam type, or restructure","handlingStrategy":"validation","validationCode":"for (Descriptors.FieldDescriptor f : msgDescriptor.getFields()) { switch (f.getJavaType()) { case MESSAGE: case STRING: case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case ENUM: case BYTE_STRING: continue; default: throw new IllegalStateException(\"Unsupported proto type in field \" + f.getName()); } }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep message field types to the Beam-supported set","Pin Beam SDK and protobuf versions together and test conversion on upgrade","Add a startup smoke test that builds converters for every schema message"],"tags":["protobuf","beam","unsupported-type"],"backgroundTag":"unsupported-operation","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"}