{"record":{"id":"b584abb6dd55e913","repo":"apache/beam","slug":"unexpected-beam-type-beamfieldtype","errorCode":null,"errorMessage":"Unexpected beam type \" + beamFieldType","messagePattern":"Unexpected beam type \" \\+ beamFieldType","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BeamRowToStorageApiProto.java","lineNumber":408,"sourceCode":"      }\n      if (logicalType.getIdentifier().equals(Timestamp.IDENTIFIER)) {\n        Instant instant = (Instant) value;\n        Descriptor timestampPicosDescriptor =\n            Preconditions.checkNotNull(fieldDescriptor).getMessageType();\n        return buildTimestampPicosMessage(timestampPicosDescriptor, instant);\n      }\n      @Nullable\n      BiFunction<LogicalType<?, ?>, Object, Object> logicalTypeEncoder =\n          LOGICAL_TYPE_ENCODERS.get(logicalType.getIdentifier());\n      if (logicalTypeEncoder == null) {\n        throw new RuntimeException(\"Unsupported logical type \" + logicalType.getIdentifier());\n      }\n      return logicalTypeEncoder.apply(logicalType, value);\n    } else {\n      @Nullable\n      Function<Object, Object> encoder = PRIMITIVE_ENCODERS.get(beamFieldType.getTypeName());\n      if (encoder == null) {\n        throw new RuntimeException(\"Unexpected beam type \" + beamFieldType);\n      }\n      return encoder.apply(value);\n    }\n  }\n\n  static Object mapEntryToProtoValue(\n      Descriptor descriptor,\n      FieldType keyFieldType,\n      FieldType valueFieldType,\n      Map.Entry<Object, Object> entryValue) {\n    DynamicMessage.Builder builder = DynamicMessage.newBuilder(descriptor);\n    FieldDescriptor keyFieldDescriptor =\n        Preconditions.checkNotNull(descriptor.findFieldByName(\"key\"));\n    @Nullable Object key = toProtoValue(keyFieldDescriptor, keyFieldType, entryValue.getKey());\n    if (key != null) {\n      builder.setField(keyFieldDescriptor, key);\n    }\n    FieldDescriptor valueFieldDescriptor =","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BeamRowToStorageApiProto.java#L390-L426","documentation":"scalarToProtoValue maps each primitive Beam FieldType to a protobuf encoder via the PRIMITIVE_ENCODERS map. When the field's type name has no registered encoder, it throws this RuntimeException, meaning the Beam type cannot be represented as a scalar in the BigQuery Storage API proto schema.","triggerScenarios":"Writing a Row containing a primitive Beam FieldType that the BigQuery Storage API sink has no encoder for (e.g. unsupported nested/byte type used as a scalar) to a BigQuery sink using the Storage Write API.","commonSituations":"Schemas built programmatically with an exotic FieldType (e.g. unsupported iterable/row nested as a scalar slot), or after Beam version changes where a type is added to Schema but not yet mapped to BigQuery NUMERIC/JSON/proto encoders.","solutions":["Change the field to a supported Beam type (BOOLEAN, INT64, FLOAT, DOUBLE, STRING, BYTES, DATETIME, logical types)","Pre-convert unsupported types to strings or supported primitives before the sink","Check the Beam version for known gaps between Schema types and BigQuery support and upgrade","Use a different BigQuery sink method that tolerates the type"],"exampleFix":"// before\nSchema.Field.of(\"blob\", Schema.FieldType.iterable(Schema.FieldType.BYTE))\n// after\nSchema.Field.of(\"blob\", Schema.FieldType.BYTES)","handlingStrategy":"validation","validationCode":"Set<Schema.TypeName> supported = Set.of(BOOLEAN, INT64, FLOAT, DOUBLE, STRING, BYTES, DATETIME);\nif (!supported.contains(field.getType().getTypeName())) throw new IllegalArgumentException(\"Type \" + field.getType() + \" not supported by BigQuery Storage API sink\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the supported Beam type list for BigQueryIO STORAGE_API before designing schemas","Convert exotic types to STRING in a MapElements upstream","Pin and test against the Beam version used in production"],"tags":["java","apache-beam","bigquery","serialization","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}