{"record":{"id":"cbebd3421ad9d675","repo":"apache/beam","slug":"unsupported-timestamp-value-type-s","errorCode":null,"errorMessage":"Unsupported timestamp value type: %s","messagePattern":"Unsupported timestamp value type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java","lineNumber":1666,"sourceCode":"        && schemaInformation.getTimestampPrecision() == PICOSECOND_PRECISION) {\n\n      long seconds;\n      long picoseconds;\n\n      if (value instanceof String) {\n        TimestampPicos parsed = TimestampPicos.fromString((String) value);\n        seconds = parsed.seconds;\n        picoseconds = parsed.picoseconds;\n\n      } else if (value instanceof Instant || value instanceof org.joda.time.Instant) {\n        Instant timestamp =\n            value instanceof Instant\n                ? (Instant) value\n                : Instant.ofEpochMilli(((org.joda.time.Instant) value).getMillis());\n        seconds = timestamp.getEpochSecond();\n        picoseconds = timestamp.getNano() * 1000L;\n      } else {\n        throw new IllegalArgumentException(\n            \"Unsupported timestamp value type: \" + value.getClass().getName());\n      }\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    }","sourceCodeStart":1648,"sourceCodeEnd":1684,"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#L1648-L1684","documentation":"The TIMESTAMP converter only accepts java.time.Instant, org.joda.time.Instant, and (per surrounding code) Long millis and String forms. A value of any other Java type in a TIMESTAMP field triggers this IllegalArgumentException naming the actual class.","triggerScenarios":"Setting a TIMESTAMP field in a TableRow to an unsupported object type — e.g. java.util.Date, java.sql.Timestamp, LocalDateTime, ZonedDateTime — then writing via the Storage API proto conversion.","commonSituations":"JDBC/Spark sources producing java.sql.Timestamp; Jackson deserializing timestamps into Date or LocalDateTime; mixing java.time and Joda time types after a Beam migration (Beam moved from Joda to java.time).","solutions":["Convert the value to java.time.Instant before putting it in the TableRow (Instant.ofEpochMilli(millis) or value.toInstant()).","If it's a String, ensure ISO-8601 format compatible with the string converter.","For legacy Joda Instant, keep it — it is accepted — but don't mix with java.util.Date.","Fix upstream serialization to emit epoch millis or ISO strings instead of Date objects."],"exampleFix":"// before\nrow.set(\"ts\", new java.util.Date());\n// after\nrow.set(\"ts\", Instant.ofEpochMilli(date.getTime()));","handlingStrategy":"type-guard","validationCode":"Object v = row.get(\"ts\"); if (!(v instanceof Instant || v instanceof org.joda.time.Instant || v instanceof Long || v instanceof String)) { throw new IllegalArgumentException(\"ts must be Instant/Long/String\"); }","typeGuard":"boolean isTimestampValue(Object v) { return v instanceof java.time.Instant || v instanceof org.joda.time.Instant || v instanceof Long || v instanceof String; }","tryCatchPattern":"try { writeRow(row); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unsupported timestamp value type\")) row.set(\"ts\", coerceToInstant(row.get(\"ts\"))); }","preventionTips":["Normalize all timestamps to java.time.Instant at the source transform","Replace java.util.Date/java.sql.Timestamp with Instant during ingestion (Beam moved from Joda to java.time)","Never put LocalDateTime/ZonedDateTime into TIMESTAMP fields — they lack an instant/zone"],"tags":["bigquery","timestamp","type-mismatch","java"],"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"}