{"record":{"id":"730632f35c87002e","repo":"apache/beam","slug":"unknown-mode-s","errorCode":null,"errorMessage":"Unknown mode %s","messagePattern":"Unknown mode (.+?)","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/TableRowToStorageApiProto.java","lineNumber":579,"sourceCode":"        Optional.ofNullable(mode)\n            .map(Mode::valueOf)\n            .map(MODE_MAP_JSON_PROTO::get)\n            .orElse(TableFieldSchema.Mode.NULLABLE);\n    if (defaultValueExpression == null) {\n      return resultMode;\n    } else {\n      // If there is a default value expression, treat this field as if it were nullable or\n      // repeated.\n      return resultMode.equals(TableFieldSchema.Mode.REPEATED)\n          ? resultMode\n          : TableFieldSchema.Mode.NULLABLE;\n    }\n  }\n\n  public static String protoModeToJsonMode(TableFieldSchema.Mode protoMode) {\n    String jsonMode = MODE_MAP_PROTO_JSON.get(protoMode);\n    if (jsonMode == null) {\n      throw new RuntimeException(\"Unknown mode \" + protoMode);\n    }\n    return jsonMode;\n  }\n\n  public static String protoTypeToJsonType(TableFieldSchema.Type protoType) {\n    String type = TYPE_MAP_PROTO_JSON.get(protoType);\n    if (type == null) {\n      throw new RuntimeException(\"Unknown type \" + protoType);\n    }\n    return type;\n  }\n\n  public static TableFieldSchema.Type typeToProtoType(String type) {\n    TableFieldSchema.Type protoType = TYPE_MAP_JSON_PROTO.get(type);\n    if (protoType == null) {\n      throw new RuntimeException(\"Unknown type \" + type);\n    }\n    return protoType;","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java#L561-L597","documentation":"protoModeToJsonMode translates a protobuf TableFieldSchema.Mode (NULLABLE/REQUIRED/REPEATED) to the legacy JSON API mode string via MODE_MAP_PROTO_JSON. If the proto mode has no mapping (e.g. an unknown/added enum value from a newer API version), it throws RuntimeException(\"Unknown mode ...\").","triggerScenarios":"Calling protoModeToJsonMode with a TableFieldSchema.Mode value absent from MODE_MAP_PROTO_JSON, e.g. a mode introduced by a newer BigQuery Storage API than the Beam version's map covers.","commonSituations":"Running an older Beam version against schemas produced by a newer BigQuery API/client that emits an unrecognized mode; hand-constructed proto schemas with null or exotic modes.","solutions":["Upgrade google-cloud-bigquery / Beam to a version whose MODE_MAP_PROTO_JSON covers the schema's mode values.","Inspect the schema (bq show --schema) and normalize modes to NULLABLE/REQUIRED/REPEATED before feeding the pipeline.","If hand-building schemas, use TableFieldSchema.Mode values known to Beam."],"exampleFix":"// before\nTableFieldSchema.Mode mode = TableFieldSchema.Mode.UNRECOGNIZED_VALUE; // from newer API\n// after\n// upgrade dependencies or map manually:\nString jsonMode = protoMode == null ? \"NULLABLE\" : protoMode.name();","handlingStrategy":"try-catch","validationCode":"if (TableFieldSchema.Mode.UNRECOGNIZED_VALUE.equals(protoMode)) {\n  throw new IllegalArgumentException(\"Mode not supported by this Beam version: \" + protoMode);\n}","typeGuard":null,"tryCatchPattern":"try {\n  String jsonMode = TableRowToStorageApiProto.protoModeToJsonMode(protoMode);\n} catch (RuntimeException e) {\n  LOG.error(\"Unmapped proto mode {}; upgrade Beam/gcloud libs\", protoMode, e);\n  throw e;\n}","preventionTips":["Keep Beam and google-cloud-bigquery dependencies on compatible, current versions.","Check schema modes against supported values when schemas come from newer API clients."],"tags":["java","beam","bigquery","schema","enum"],"backgroundTag":"invalid-enum-value","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"}