{"record":{"id":"7b07559dcfa922b2","repo":"apache/beam","slug":"cannot-set-both-version-and-timestamp","errorCode":null,"errorMessage":"Cannot set both version and timestamp.","messagePattern":"Cannot set both version and timestamp\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/delta/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/delta/DeltaTable.java","lineNumber":103,"sourceCode":"                \"Beam write property '%s' is not supported. Writing to Delta Lake tables is currently not supported.\",\n                key));\n      } else if (lowerKey.startsWith(BEAM_READ_PROPERTY)) {\n        // none supported yet\n        throw new IllegalArgumentException(\"Unknown Beam read property: \" + key);\n      } else if (lowerKey.equalsIgnoreCase(VERSION_FIELD)) {\n        parsedVersion = parseVersion(val);\n      } else if (lowerKey.equalsIgnoreCase(TIMESTAMP_FIELD)) {\n        parsedTimestamp = val.asText();\n      } else if (lowerKey.equalsIgnoreCase(HADOOP_CONFIG_FIELD)\n          || lowerKey.equalsIgnoreCase(HADOOP_CONFIG_CAMEL_FIELD)) {\n        parseHadoopConfig(val, parsedHadoopConfig);\n      } else {\n        throw new IllegalArgumentException(String.format(\"Unknown property '%s'\", key));\n      }\n    }\n\n    if (parsedVersion != null && parsedTimestamp != null) {\n      throw new IllegalArgumentException(\"Cannot set both version and timestamp.\");\n    }\n\n    this.version = parsedVersion;\n    this.timestamp = parsedTimestamp;\n    this.hadoopConfig = parsedHadoopConfig.isEmpty() ? null : parsedHadoopConfig;\n  }\n\n  private static Long parseVersion(JsonNode val) {\n    if (val.isNumber()) {\n      return val.asLong();\n    }\n    return Long.parseLong(val.asText());\n  }\n\n  private static void parseHadoopConfig(JsonNode val, Map<String, String> targetMap) {\n    if (val.isObject()) {\n      Map<String, String> map =\n          TableUtils.getObjectMapper()","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/delta/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/delta/DeltaTable.java#L85-L121","documentation":"DeltaTable rejects specifying both a 'version' and a 'timestamp' property, since a Delta table snapshot can be resolved by exactly one of the two time-travel selectors, not both. The check is a mutually-exclusive-options guard in the constructor/property validation.","triggerScenarios":"Creating a DeltaTable whose properties include both a non-null parsed version and a non-null parsed timestamp.","commonSituations":"Merging property maps from multiple config sources so both keys end up present; template defaults including 'timestamp' while the user also sets 'version'.","solutions":["Remove either the 'version' or the 'timestamp' property, keeping only one.","Decide the snapshot-selection strategy (time travel by version OR by timestamp) and configure accordingly."],"exampleFix":"// before\nTBLPROPERTIES { 'version': '5', 'timestamp': '\"2024-01-01T00:00:00Z\"' }\n// after\nTBLPROPERTIES { 'version': '5' }","handlingStrategy":"validation","validationCode":"if (properties.containsKey(\"version\") && properties.containsKey(\"timestamp\")) {\n  throw new IllegalArgumentException(\"Specify only one of 'version' or 'timestamp' for Delta time travel\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  table = new DeltaTable(tableId, schema, properties);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"both version and timestamp\")) {\n    properties.remove(\"timestamp\"); // keep version-based time travel\n  }\n}","preventionTips":["Choose one time-travel strategy (version OR timestamp) per table config.","When merging property maps, check for duplicate/conflicting semantic keys.","Document the chosen snapshot-selection strategy in your pipeline config."],"tags":["java","beam-sql","delta-lake","time-travel","config"],"backgroundTag":"mutually-exclusive-options","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"}