{"record":{"id":"7720dfc9bc3277c4","repo":"apache/iceberg","slug":"cannot-set-namespace-properties-namespace","errorCode":null,"errorMessage":"Cannot set namespace properties \" + namespace + \" : setProperties is not supported","messagePattern":"Cannot set namespace properties \" \\+ namespace \\+ \" : setProperties is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java","lineNumber":356,"sourceCode":"\n    if (!isNamespace(nsPath) || namespace.isEmpty()) {\n      return false;\n    }\n\n    try {\n      if (fs.listStatusIterator(nsPath).hasNext()) {\n        throw new NamespaceNotEmptyException(\"Namespace %s is not empty.\", namespace);\n      }\n\n      return fs.delete(nsPath, false /* recursive */);\n    } catch (IOException e) {\n      throw new RuntimeIOException(e, \"Namespace delete failed: %s\", namespace);\n    }\n  }\n\n  @Override\n  public boolean setProperties(Namespace namespace, Map<String, String> properties) {\n    throw new UnsupportedOperationException(\n        \"Cannot set namespace properties \" + namespace + \" : setProperties is not supported\");\n  }\n\n  @Override\n  public boolean removeProperties(Namespace namespace, Set<String> properties) {\n    throw new UnsupportedOperationException(\n        \"Cannot remove properties \" + namespace + \" : removeProperties is not supported\");\n  }\n\n  @Override\n  public Map<String, String> loadNamespaceMetadata(Namespace namespace) {\n    Path nsPath = new Path(warehouseLocation, SLASH.join(namespace.levels()));\n\n    if (!isNamespace(nsPath) || namespace.isEmpty()) {\n      throw new NoSuchNamespaceException(\"Namespace does not exist: %s\", namespace);\n    }\n\n    return ImmutableMap.of(\"location\", nsPath.toString());","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java#L338-L374","documentation":"HadoopCatalog does not support setting properties on a namespace: namespace metadata in the Hadoop filesystem layout is just a directory with a fixed 'location' entry. Any call to setProperties throws UnsupportedOperationException unconditionally.","triggerScenarios":"Calling catalog.setProperties(namespace, props) on a HadoopCatalog instance — e.g. from testAlterNamespaceMeta-style code or engine integrations that generically call the NamespaceOperations API.","commonSituations":"Code written against HiveCatalog or RESTCatalog being reused with HadoopCatalog; framework code that updates namespace properties for all catalog implementations; migration from a catalog that supports properties to the Hadoop-based one.","solutions":["Switch to a catalog implementation that supports namespace properties (HiveCatalog, JDBC catalog, REST catalog).","Remove the setProperties call for HadoopCatalog; there are no supported namespace properties.","Handle UnsupportedOperationException if your code must work across catalog types.","Store custom metadata out-of-band (e.g. in a properties file in the namespace directory via FileIO) if truly needed."],"exampleFix":"// before\ncatalog.setProperties(Namespace.of(\"db\"), ImmutableMap.of(\"owner\", \"data-team\"));\n// after\nif (catalog instanceof HadoopCatalog) {\n  throw new UnsupportedOperationException(\"HadoopCatalog does not support namespace properties\");\n} else {\n  catalog.setProperties(Namespace.of(\"db\"), ImmutableMap.of(\"owner\", \"data-team\"));\n}","handlingStrategy":"fallback","validationCode":"if (catalog instanceof HadoopCatalog) {\n  // skip setProperties: unsupported\n}","typeGuard":"boolean supportsNsProps = !(catalog instanceof HadoopCatalog);","tryCatchPattern":"try {\n  catalog.setProperties(ns, props);\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"Catalog {} does not support namespace properties\", catalog.getClass().getSimpleName());\n}","preventionTips":["Know your catalog type before calling SupportsNamespaces property methods.","Keep custom namespace metadata in a store that supports it (Hive metastore, REST catalog).","Write cross-catalog code defensively around UnsupportedOperationException."],"tags":["unsupported","namespace","catalog","hadoop"],"backgroundTag":"unsupported-operation","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"}