apache/beam · error · java.lang.UnsupportedOperationException

Unsupported proto type

Error message

Unsupported proto type: ${javaType}

What it means

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.

Solutions

  1. Check the field's JavaType/descriptor kind against the switch in ProtoBeamConverter and use a supported type
  2. Replace the offending field type with a supported proto type (message, primitives, map, enum)
  3. Perform an intermediate transformation so the field reaches the converter as a supported type
  4. If the type should be supported, upgrade the Beam SDK to a version that handles it

Example fix

// before
message M { SomeUnsupportedType f = 1; }
// after
message M { string f = 1; } // map to a supported Beam type, or restructure
Defensive patterns

Strategy: validation

Validate before calling

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()); } }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/c39ac77e2d62e5fa. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoBeamConverter.java:266

                  .build();
            };
          case "google.protobuf.Duration":
            return beam -> {
              Duration duration = (Duration) beam;
              return com.google.protobuf.Duration.newBuilder()
                  .setSeconds(duration.getSeconds())
                  .setNanos(duration.getNano())
                  .build();
            };
          case "google.protobuf.Any":
            throw new UnsupportedOperationException("google.protobuf.Any is not supported");
          default:
            SerializableFunction<Row, Message> converter =
                toProto(fieldDescriptor.getMessageType());
            return value -> converter.apply((Row) value);
        }
      default:
        throw new UnsupportedOperationException(
            "Unsupported proto type: " + fieldDescriptor.getJavaType());
    }
  }

  /** Gets a converter from non-null Proto value to non-null Beam. */
  static <ProtoUnwrappedT, BeamT>
      ProtoToBeamConverter<Object, BeamT> createWrappableProtoToBeamConverter(
          ProtoToBeamConverter<ProtoUnwrappedT, BeamT> converter) {
    return protoValue -> {
      @NonNull ProtoUnwrappedT unwrappedProtoValue;
      if (protoValue instanceof Message) {
        // A google protobuf wrapper
        Message protoWrapper = (Message) protoValue;
        Descriptors.FieldDescriptor wrapperValueFieldDescriptor =
            protoWrapper.getDescriptorForType().findFieldByNumber(1);
        unwrappedProtoValue =
            (@NonNull ProtoUnwrappedT)
                Preconditions.checkNotNull(protoWrapper.getField(wrapperValueFieldDescriptor));

View on GitHub (pinned to 12126d8942)