{"record":{"id":"d2c5192dd0d80aed","repo":"apache/beam","slug":"field-type-not-matched","errorCode":null,"errorMessage":"Field type not matched.","messagePattern":"Field type not matched\\.","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoSchemaTranslator.java","lineNumber":366,"sourceCode":"          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  }\n\n  private static Schema.Options.Builder getSchemaOptions(Descriptors.Descriptor descriptor) {\n    return getOptions(SCHEMA_OPTION_MESSAGE_PREFIX, descriptor.getOptions().getAllFields());\n  }\n\n  private static Schema.Options.Builder getOptions(","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoSchemaTranslator.java#L348-L384","documentation":"The switch over proto field types in beamFieldTypeFromSingularProtoField has a default branch that throws RuntimeException(\"Field type not matched.\") — reached when the field's Java proto Type (the switch subject) is not one of the handled cases. It is a defensive fall-through indicating the translator does not know how to map this proto field's type to a Beam FieldType.","triggerScenarios":"A proto field whose Java type constant falls outside every handled case in the switch over protoFieldDescriptor (e.g. unhandled scalar/type mapping introduced by newer protobuf versions or GROUP-like types reaching the singular-field path).","commonSituations":"Upgrading protobuf-java/runtime so new type kinds appear; exotic field descriptors (extension ranges, groups) reaching schema translation; internal API misuse calling beamFieldTypeFromSingularProtoField with a descriptor type it wasn't designed for.","solutions":["Identify the proto field's type (from the message text of the exception context) and replace it with a supported type in the .proto file.","Upgrade (or pin) the Beam version so the translator handles the field type; check Beam JIRA for the missing mapping.","Pre-convert the unsupported field to bytes/string in a wrapper message before schema translation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Java: check the proto field's type is a kind the translator handles (scalars, ENUM, MESSAGE)\nstatic boolean isSupportedKind(Descriptors.FieldDescriptor.Type t) {\n  switch (t) {\n    case GROUP: return false; // extend with any other unhandled kinds discovered\n    default: return true;\n  }\n}","typeGuard":null,"tryCatchPattern":"try { Schema s = ProtoSchemaTranslator.getSchema(descriptor); } catch (RuntimeException e) { if (\"Field type not matched.\".equals(e.getMessage())) { /* translate that field to bytes/string manually or upgrade Beam */ } else throw e; }","preventionTips":["Avoid proto2 group fields and exotic descriptor kinds in protos used with Beam schema inference.","Pin a Beam version known to map all field types your protos use; run schema inference in CI.","Keep protos fed to the translator limited to standard scalar/enum/message fields."],"tags":["protobuf","type-mapping","java","beam-schema"],"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"}