{"record":{"id":"ec6e0ddd1eff22be","repo":"apache/beam","slug":"unexpected-value-value-type-value-getclass-table-field-name","errorCode":null,"errorMessage":"Unexpected value: ${value}, type: ${value.getClass()}. Table field name: ${schemaInformation.getFullName()}, type: ${schemaInformation.getType()}","messagePattern":"Unexpected value: (.+?), type: (.+?)\\. Table field name: (.+?), type: (.+?)","errorType":"exception","errorClass":"SchemaDoesntMatchException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java","lineNumber":1686,"sourceCode":"      }\n\n      Descriptor messageType = Preconditions.checkArgumentNotNull(fieldDescriptor).getMessageType();\n      converted =\n          DynamicMessage.newBuilder(messageType)\n              .setField(messageType.findFieldByName(\"seconds\"), seconds)\n              .setField(messageType.findFieldByName(\"picoseconds\"), picoseconds)\n              .build();\n\n    } else {\n      @Nullable ThrowingBiFunction<String, Object, @Nullable Object> converter =\n          TYPE_MAP_PROTO_CONVERTERS.get(schemaInformation.getType());\n      if (converter == null) {\n        throw new RuntimeException(\"Unknown type \" + schemaInformation.getType());\n      }\n      converted = converter.apply(schemaInformation.getFullName(), value);\n    }\n    if (converted == null) {\n      throw new SchemaDoesntMatchException(\n          \"Unexpected value: \"\n              + value\n              + \", type: \"\n              + (value == null ? \"null\" : value.getClass())\n              + \". Table field name: \"\n              + schemaInformation.getFullName()\n              + \", type: \"\n              + schemaInformation.getType());\n    }\n    return converted;\n  }\n\n  private static long toEpochMicros(Instant timestamp) {\n    // i.e 1970-01-01T00:01:01.000040Z: 61 * 1000_000L + 40000/1000 = 61000040\n    return timestamp.getEpochSecond() * 1000_000L + timestamp.getNano() / 1000;\n  }\n\n  @VisibleForTesting","sourceCodeStart":1668,"sourceCodeEnd":1704,"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#L1668-L1704","documentation":"After applying the type converter, the converted value came back null (or the input was null for a non-nullable field), so a SchemaDoesntMatchException is thrown describing the value, its Java class, and the table field's full name and declared type. It signals the value did not match what the declared BigQuery type can hold.","triggerScenarios":"A converter (numeric parse, timestamp parse, bool parse, etc.) returns null because the supplied value's runtime type/format doesn't fit the declared field type — e.g. passing \"abc\" for INT64 or a Map for a FLOAT64 field.","commonSituations":"Stringly-typed ETL output feeding typed columns; nulls landing in REQUIRED fields; mixed-type JSON columns; locale-formatted numbers that fail parsing.","solutions":["Inspect the message's field name and type, then fix the supplied value's type/format at the source.","Pre-validate rows against the schema (types, nullability) before the sink.","Use null-safe casting in the producing transform (e.g. parse with fallback or dead-letter invalid rows).","Make nullable fields NULLABLE in the table schema if legitimate nulls must pass."],"exampleFix":"// before\nrow.set(\"qty\", \"12a\"); // INT64\n// after\nrow.set(\"qty\", Long.parseLong(\"12\")); // or fix upstream data","handlingStrategy":"validation","validationCode":"if (value == null && !\"NULLABLE\".equals(fieldMode)) throw new IllegalArgumentException(fieldFullName + \" is not nullable\"); if (value != null && converterWouldReturnNull(value, fieldType)) throw new IllegalArgumentException(\"bad value \" + value + \" for \" + fieldType);","typeGuard":"boolean convertible(Object v, String bqType) { if (v == null) return \"NULLABLE\".equals(bqTypeMode); try { return convert(bqType, v) != null; } catch (Exception e) { return false; } }","tryCatchPattern":"try { messageFromTableRow(...); } catch (SchemaDoesntMatchException e) { LOG.warn(\"Bad value for field {}: {}\", e.getMessage()); deadLetter(row); }","preventionTips":["Reject or repair stringly-typed values at ingest (parse/validate before the sink)","Route non-conforming rows to a dead-letter PCollection with the SchemaDoesntMatchException message","Declare legitimately-null fields NULLABLE in the table schema","Standardize value formats (ISO-8601, plain decimal strings) across producers"],"tags":["bigquery","schema","type-mismatch","java"],"backgroundTag":"schema-validation-failed","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"}