apache/beam · error · UnsupportedOperationException

google.protobuf.Any is not supported

Error message

google.protobuf.Any is not supported

What it means

Beam's ProtoBeamConverter translates protobuf messages to/from Beam Rows. The google.protobuf.Any well-known type has no Beam Row representation implemented, so when converting a schema-bearing message whose field type resolves to Any, the converter throws UnsupportedOperationException at converter-construction time.

Solutions

  1. Remove the google.protobuf.Any field from the message, or wrap it in a message type the converter supports
  2. Replace Any with a concrete message type or a oneof of supported types
  3. Convert the Any field to a primitive (e.g. bytes type_url+value) in an intermediate message before Beam conversion
  4. Pre-convert the message yourself (toJSON/base64 the Any) and carry it as a STRING/BYTES Beam field

Example fix

// before
message Wrapper { google.protobuf.Any payload = 1; }
// after
message Wrapper { SpecificPayload payload = 1; } // or oneof of concrete types
Defensive patterns

Strategy: validation

Validate before calling

boolean usesAny(Descriptors.Descriptor d) { for (Descriptors.FieldDescriptor f : d.getFields()) { if ("google.protobuf.Any".equals(f.getMessageType() != null ? f.getMessageType().getFullName() : "")) return true; } return false; }

Prevention

When it happens

Trigger: Building a Beam-to-proto converter (toProto/createBeamToProtoConverter, or map keys/values) for a message type that contains a field of type google.protobuf.Any.

Common situations: Protobuf schemas that use Any for polymorphic payloads (common in gRPC-adjacent message definitions) being ingested or emitted via Beam's schema API; teams migrating a proto with Any fields into a Beam pipeline.

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/ca4fcfd98afe2ea2. Report an issue: GitHub.

Appendix: source

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

                fieldDescriptor, bytes -> ByteString.copyFrom((byte[]) bytes));
          case "google.protobuf.Timestamp":
            return beam -> {
              Instant instant = (Instant) beam;
              return Timestamp.newBuilder()
                  .setSeconds(instant.getEpochSecond())
                  .setNanos(instant.getNano())
                  .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) {

View on GitHub (pinned to 12126d8942)