apache/beam · error · java.lang.UnsupportedOperationException

Any not yet supported

Error message

Any not yet supported

What it means

The translator special-cases google.protobuf well-known types (Timestamp, Duration) but has no mapping for google.protobuf.Any. When a message field's type is Any, the translator throws UnsupportedOperationException because Any's dynamically-typed payload cannot be represented as a static Beam schema.

Solutions

  1. Replace the Any field with a concrete message type or a oneof of the concrete types you actually use.
  2. Store the Any as bytes in Beam by changing the field to bytes and packing/unpacking Any manually in a DoFn.
  3. Unpack the Any into a known concrete message before handing the message to Beam (proto.Any.Unpack in a map step).

Example fix

// before
import "google/protobuf/any.proto";
message Envelope { google.protobuf.Any payload = 1; } // Any not yet supported
// after
message Envelope { oneof payload { MyTypeA a = 1; MyTypeB b = 2; } }
Defensive patterns

Strategy: validation

Validate before calling

// Java: reject google.protobuf.Any fields before translation
static boolean containsAny(Descriptors.Descriptor d, Set<String> visited) {
  if (!visited.add(d.getFullName())) return false;
  for (Descriptors.FieldDescriptor f : d.getFields()) {
    if (f.getType() == Descriptors.FieldDescriptor.Type.MESSAGE) {
      if ("google.protobuf.Any".equals(f.getMessageType().getFullName())) return true;
      if (containsAny(f.getMessageType(), visited)) return true;
    }
  }
  return false;
}

Try / catch

try { Schema s = ProtoSchemaTranslator.getSchema(descriptor); } catch (UnsupportedOperationException e) { if (e.getMessage().contains("Any not yet supported")) { /* use concrete types or bytes field */ } else throw e; }

Prevention

When it happens

Trigger: Running a Beam pipeline with protoToRow/ProtoSchemaTranslator.getSchema over a message containing a `google.protobuf.Any` field.

Common situations: Protos using Any to embed arbitrary messages (common in extension points, error details per grpc spec, or API envelopes); migrating gRPC service protos into Beam pipelines.

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

Appendix: source

Thrown at sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoSchemaTranslator.java:360

            break;
          case "google.protobuf.Int32Value":
          case "google.protobuf.UInt32Value":
          case "google.protobuf.Int64Value":
          case "google.protobuf.UInt64Value":
          case "google.protobuf.FloatValue":
          case "google.protobuf.DoubleValue":
          case "google.protobuf.StringValue":
          case "google.protobuf.BoolValue":
          case "google.protobuf.BytesValue":
            fieldType =
                beamFieldTypeFromSingularProtoField(
                    protoFieldDescriptor.getMessageType().findFieldByNumber(1));
            break;
          case "google.protobuf.Duration":
            fieldType = FieldType.logicalType(new NanosDuration());
            break;
          case "google.protobuf.Any":
            throw new UnsupportedOperationException("Any not yet supported");
          default:
            fieldType = FieldType.row(getSchema(protoFieldDescriptor.getMessageType()));
        }
        break;
      default:
        throw new RuntimeException("Field type not matched.");
    }

    if (isNullable(protoFieldDescriptor)) {
      fieldType = fieldType.withNullable(true);
    }

    return fieldType;
  }

  private static Schema.Options.Builder getFieldOptions(FieldDescriptor fieldDescriptor) {
    return getOptions(SCHEMA_OPTION_FIELD_PREFIX, fieldDescriptor.getOptions().getAllFields());
  }

View on GitHub (pinned to 12126d8942)