{"record":{"id":"a0af1287b3e89f4a","repo":"apache/iceberg","slug":"cannot-remove-properties-namespace-remov","errorCode":null,"errorMessage":"Cannot remove properties \" + namespace + \" : removeProperties is not supported","messagePattern":"Cannot remove properties \" \\+ namespace \\+ \" : removeProperties is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java","lineNumber":362,"sourceCode":"      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());\n  }\n\n  private boolean isNamespace(Path path) {\n    return isDirectory(path) && !isTableDir(path);\n  }\n","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java#L344-L380","documentation":"Unconditional guard in HadoopCatalog.removeProperties: namespace properties are stored as filesystem directories in the Hadoop catalog, which has no place to persist properties, so removing them is unsupported. Like setProperties, any call fails up front regardless of arguments.","triggerScenarios":"Calling catalog.removeProperties(namespace, props) on a HadoopCatalog, e.g. when generically cleaning up namespace metadata through the SupportsNamespaces interface.","commonSituations":"Shared catalog-abstraction code paths that both set and remove properties; test suites exercising SupportsNamespaces against every implementation; cleanup scripts ported from Hive/JDBC catalogs.","solutions":["Use a catalog that supports namespace properties (HiveCatalog, JDBC, REST) if removal is required.","Drop the removeProperties call; it can never succeed on HadoopCatalog.","Catch UnsupportedOperationException when writing cross-catalog code.","Clean up by dropping and recreating the namespace if properties were stored out-of-band."],"exampleFix":"// before\ncatalog.removeProperties(Namespace.of(\"db\"), ImmutableSet.of(\"owner\"));\n// after\nif (!(catalog instanceof HadoopCatalog)) {\n  catalog.removeProperties(Namespace.of(\"db\"), ImmutableSet.of(\"owner\"));\n}","handlingStrategy":"fallback","validationCode":"if (catalog instanceof HadoopCatalog) {\n  // skip removeProperties: unsupported\n}","typeGuard":"boolean supportsNsProps = !(catalog instanceof HadoopCatalog);","tryCatchPattern":"try {\n  catalog.removeProperties(ns, keys);\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"removeProperties unsupported on {}\", catalog.getClass().getSimpleName());\n}","preventionTips":["Avoid storing namespace properties in HadoopCatalog in the first place.","Use HiveCatalog/JDBC/REST catalogs when namespace properties are required.","Centralize namespace property operations behind an adapter that no-ops for unsupported catalogs."],"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"}