{"record":{"id":"bbf78121fba471b7","repo":"apache/iceberg","slug":"cannot-update-partition-spec-with-unknown-transfor","errorCode":null,"errorMessage":"Cannot update partition spec with unknown transform: ","messagePattern":"Cannot update partition spec with unknown transform: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/BaseUpdatePartitionSpec.java","lineNumber":82,"sourceCode":"\n  BaseUpdatePartitionSpec(TableOperations ops) {\n    this.ops = ops;\n    this.caseSensitive = true;\n    this.setAsDefault = true;\n    this.base = ops.current();\n    this.formatVersion = base.formatVersion();\n    this.spec = base.spec();\n    this.schema = spec.schema();\n    this.nameToField = indexSpecByName(spec);\n    this.transformToField = indexSpecByTransform(spec);\n    this.lastAssignedPartitionId = base.lastAssignedPartitionId();\n\n    spec.fields().stream()\n        .filter(field -> field.transform() instanceof UnknownTransform)\n        .findAny()\n        .ifPresent(\n            field -> {\n              throw new IllegalArgumentException(\n                  \"Cannot update partition spec with unknown transform: \" + field);\n            });\n  }\n\n  /** For testing only. */\n  @VisibleForTesting\n  BaseUpdatePartitionSpec(int formatVersion, PartitionSpec spec) {\n    this(formatVersion, spec, spec.lastAssignedFieldId());\n  }\n\n  /** For testing only. */\n  @VisibleForTesting\n  BaseUpdatePartitionSpec(int formatVersion, PartitionSpec spec, int lastAssignedPartitionId) {\n    this.ops = null;\n    this.base = null;\n    this.formatVersion = formatVersion;\n    this.caseSensitive = true;\n    this.setAsDefault = true;","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/BaseUpdatePartitionSpec.java#L64-L100","documentation":"BaseUpdatePartitionSpec validates that every existing field's transform is one it understands; a field with an UnknownTransform cannot be migrated, so the constructor throws IllegalArgumentException. This guards the spec-update path against fields created by writers using transforms this version of Iceberg does not support.","triggerScenarios":"Opening UpdatePartitionSpec (e.g. table.updateSpec().addField(...)) on a table whose current partition spec contains a field with an UnknownTransform — typically written by a newer Iceberg version or a custom writer.","commonSituations":"Version skew: an older Iceberg client updating a spec created by a newer writer using an unrecognized transform; cross-engine writers with different transform support.","solutions":["Upgrade the Iceberg client to a version that supports the transform in the existing spec","Avoid calling updateSpec on tables with unsupported transform fields from this client version","Rewrite the spec via a compatible writer that can drop the unknown field before updating"],"exampleFix":"// before\nUpdatePartitionSpec update = table.updateSpec(); // throws on UnknownTransform field\n// after\nif (table.spec().fields().stream().noneMatch(f -> f.transform() instanceof UnknownTransform)) {\n  UpdatePartitionSpec update = table.updateSpec();\n} else {\n  // upgrade client or handle unsupported field\n}","handlingStrategy":"validation","validationCode":"if (table.spec().fields().stream().anyMatch(f -> f.transform() instanceof UnknownTransform)) { throw new IllegalStateException(\"spec contains unsupported transform; upgrade client\"); }","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) { /* upgrade client or skip spec update */ }","preventionTips":["Only build transforms via the Transforms factory class","Keep Iceberg clients at versions matching the writers that created specs","Validate existing spec transforms before opening updateSpec"],"tags":["illegal-argument","partition-spec","transform","version-skew"],"backgroundTag":"invalid-argument-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}