{"record":{"id":"fea3532e42b77def","repo":"apache/iceberg","slug":"cannot-apply-unknown-namespace-change-change-fea353","errorCode":null,"errorMessage":"Cannot apply unknown namespace change: ${change}","messagePattern":"Cannot apply unknown namespace change: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":544,"sourceCode":"      throw new UnsupportedOperationException(\n          \"Namespaces are not supported by catalog: \" + catalogName);\n    }\n  }\n\n  @Override\n  public void alterNamespace(String[] namespace, NamespaceChange... changes)\n      throws NoSuchNamespaceException {\n    if (asNamespaceCatalog != null) {\n      Map<String, String> updates = Maps.newHashMap();\n      Set<String> removals = Sets.newHashSet();\n      for (NamespaceChange change : changes) {\n        if (change instanceof NamespaceChange.SetProperty) {\n          NamespaceChange.SetProperty set = (NamespaceChange.SetProperty) change;\n          updates.put(set.property(), set.value());\n        } else if (change instanceof NamespaceChange.RemoveProperty) {\n          removals.add(((NamespaceChange.RemoveProperty) change).property());\n        } else {\n          throw new UnsupportedOperationException(\n              \"Cannot apply unknown namespace change: \" + change);\n        }\n      }\n\n      try {\n        if (!updates.isEmpty()) {\n          asNamespaceCatalog.setProperties(Namespace.of(namespace), updates);\n        }\n\n        if (!removals.isEmpty()) {\n          asNamespaceCatalog.removeProperties(Namespace.of(namespace), removals);\n        }\n\n      } catch (org.apache.iceberg.exceptions.NoSuchNamespaceException e) {\n        throw new NoSuchNamespaceException(namespace);\n      }\n    } else {\n      throw new NoSuchNamespaceException(namespace);","sourceCodeStart":526,"sourceCodeEnd":562,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L526-L562","documentation":"Thrown by SparkCatalog.alterNamespace when a NamespaceChange in the change list is neither SetProperty nor RemoveProperty. Only namespace property set/remove are supported by the Iceberg catalog abstraction; any other change type (now or added in future Spark versions) is rejected with an UnsupportedOperationException.","triggerScenarios":"Calling alterNamespace with a change type outside SetProperty/RemoveProperty — e.g. a new Spark NamespaceChange subtype — or passing changes produced by newer Spark SQL syntax that this SparkCatalog version does not translate.","commonSituations":"Forward-compatibility issues after a Spark upgrade introducing new NamespaceChange kinds; custom code constructing NamespaceChange instances directly with unsupported subclasses.","solutions":["Restrict namespace changes to NamespaceChange.SetProperty and RemoveProperty","After Spark upgrades, check the Iceberg SparkCatalog version supports new change types and upgrade Iceberg if needed","Implement the translation yourself via SupportsNamespaces.setProperties/removeProperties for supported kinds","File/track an Iceberg issue for the unsupported change type"],"exampleFix":"// before\nnsc.alterNamespace(new String[]{\"prod\"}, new MyCustomNamespaceChange(\"k\"));\n// after\nnsc.alterNamespace(new String[]{\"prod\"},\n    NamespaceChange.setProperty(\"k\", \"v\"));\n// or for removal:\nnsc.alterNamespace(new String[]{\"prod\"}, NamespaceChange.removeProperty(\"k\"));","handlingStrategy":"validation","validationCode":"for (NamespaceChange change : changes) {\n  if (!(change instanceof NamespaceChange.SetProperty)\n      && !(change instanceof NamespaceChange.RemoveProperty)) {\n    throw new IllegalArgumentException(\"Unsupported namespace change: \" + change);\n  }\n}","typeGuard":"boolean isSupportedChange(NamespaceChange change) {\n  return change instanceof NamespaceChange.SetProperty\n      || change instanceof NamespaceChange.RemoveProperty;\n}","tryCatchPattern":"try {\n  nsc.alterNamespace(ns, changes);\n} catch (UnsupportedOperationException e) {\n  log.error(\"Unsupported namespace change in {}\", Arrays.toString(changes), e);\n  throw new IllegalArgumentException(\"Only SetProperty/RemoveProperty are supported\", e);\n}","preventionTips":["Only build changes via NamespaceChange.setProperty/removeProperty","Re-audit namespace alter code after Spark upgrades (new change types)","Whitelist change types before passing them to the catalog","Keep Iceberg and Spark versions aligned so change types are supported"],"tags":["spark","catalog","namespace","unsupported-change"],"backgroundTag":"unsupported-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}