{"record":{"id":"76d637b16bd9576d","repo":"apache/beam","slug":"any-not-yet-supported","errorCode":null,"errorMessage":"Any not yet supported","messagePattern":"Any not yet supported","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoSchemaTranslator.java","lineNumber":360,"sourceCode":"            break;\n          case \"google.protobuf.Int32Value\":\n          case \"google.protobuf.UInt32Value\":\n          case \"google.protobuf.Int64Value\":\n          case \"google.protobuf.UInt64Value\":\n          case \"google.protobuf.FloatValue\":\n          case \"google.protobuf.DoubleValue\":\n          case \"google.protobuf.StringValue\":\n          case \"google.protobuf.BoolValue\":\n          case \"google.protobuf.BytesValue\":\n            fieldType =\n                beamFieldTypeFromSingularProtoField(\n                    protoFieldDescriptor.getMessageType().findFieldByNumber(1));\n            break;\n          case \"google.protobuf.Duration\":\n            fieldType = FieldType.logicalType(new NanosDuration());\n            break;\n          case \"google.protobuf.Any\":\n            throw new UnsupportedOperationException(\"Any not yet supported\");\n          default:\n            fieldType = FieldType.row(getSchema(protoFieldDescriptor.getMessageType()));\n        }\n        break;\n      default:\n        throw new RuntimeException(\"Field type not matched.\");\n    }\n\n    if (isNullable(protoFieldDescriptor)) {\n      fieldType = fieldType.withNullable(true);\n    }\n\n    return fieldType;\n  }\n\n  private static Schema.Options.Builder getFieldOptions(FieldDescriptor fieldDescriptor) {\n    return getOptions(SCHEMA_OPTION_FIELD_PREFIX, fieldDescriptor.getOptions().getAllFields());\n  }","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoSchemaTranslator.java#L342-L378","documentation":"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.","triggerScenarios":"Running a Beam pipeline with protoToRow/ProtoSchemaTranslator.getSchema over a message containing a `google.protobuf.Any` field.","commonSituations":"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.","solutions":["Replace the Any field with a concrete message type or a oneof of the concrete types you actually use.","Store the Any as bytes in Beam by changing the field to bytes and packing/unpacking Any manually in a DoFn.","Unpack the Any into a known concrete message before handing the message to Beam (proto.Any.Unpack in a map step)."],"exampleFix":"// before\nimport \"google/protobuf/any.proto\";\nmessage Envelope { google.protobuf.Any payload = 1; } // Any not yet supported\n// after\nmessage Envelope { oneof payload { MyTypeA a = 1; MyTypeB b = 2; } }","handlingStrategy":"validation","validationCode":"// Java: reject google.protobuf.Any fields before translation\nstatic boolean containsAny(Descriptors.Descriptor d, Set<String> visited) {\n  if (!visited.add(d.getFullName())) return false;\n  for (Descriptors.FieldDescriptor f : d.getFields()) {\n    if (f.getType() == Descriptors.FieldDescriptor.Type.MESSAGE) {\n      if (\"google.protobuf.Any\".equals(f.getMessageType().getFullName())) return true;\n      if (containsAny(f.getMessageType(), visited)) return true;\n    }\n  }\n  return false;\n}","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["Avoid google.protobuf.Any in protos intended for Beam pipelines; prefer concrete messages or oneof.","Unpack Any into known message types in a pre-processing step before schema translation.","Check Beam release notes for Any support before relying on it."],"tags":["protobuf","any","unsupported-type","java"],"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"}