{"record":{"id":"c2a29878400e011f","repo":"apache/iceberg","slug":"cannot-create-namespace-namespace-metadat","errorCode":null,"errorMessage":"Cannot create namespace \" + namespace + \": metadata is not supported","messagePattern":"Cannot create namespace \" \\+ namespace \\+ \": metadata is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java","lineNumber":284,"sourceCode":"        }\n        return fs.delete(tablePath, true /* recursive */);\n      }\n    } catch (IOException e) {\n      throw new RuntimeIOException(e, \"Failed to delete file: %s\", tablePath);\n    }\n  }\n\n  @Override\n  public void renameTable(TableIdentifier from, TableIdentifier to) {\n    throw new UnsupportedOperationException(\"Cannot rename Hadoop tables\");\n  }\n\n  @Override\n  public void createNamespace(Namespace namespace, Map<String, String> meta) {\n    Preconditions.checkArgument(\n        !namespace.isEmpty(), \"Cannot create namespace with invalid name: %s\", namespace);\n    if (!meta.isEmpty()) {\n      throw new UnsupportedOperationException(\n          \"Cannot create namespace \" + namespace + \": metadata is not supported\");\n    }\n\n    Path nsPath = new Path(warehouseLocation, SLASH.join(namespace.levels()));\n\n    if (isNamespace(nsPath)) {\n      throw new AlreadyExistsException(\"Namespace already exists: %s\", namespace);\n    }\n\n    try {\n      fs.mkdirs(nsPath);\n\n    } catch (IOException e) {\n      throw new RuntimeIOException(e, \"Create namespace failed: %s\", namespace);\n    }\n  }\n\n  @Override","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java#L266-L302","documentation":"HadoopCatalog.createNamespace throws UnsupportedOperationException when a non-empty metadata map is passed, because the filesystem-based catalog stores no namespace metadata. The namespace is a plain directory; arbitrary properties cannot be attached.","triggerScenarios":"Calling catalog.createNamespace(namespace, meta) where meta is non-empty (e.g. porting code from HiveCatalog that sets namespace comments or properties).","commonSituations":"Migrating from Hive/Glue catalogs to HadoopCatalog while reusing namespace-creation code that carries properties; generic catalog tooling that always forwards a metadata map.","solutions":["Pass an empty map (Collections.emptyMap()) to createNamespace on HadoopCatalog.","Remove namespace property-setting code paths when targeting the Hadoop catalog.","If namespace properties are required, switch to HiveCatalog, JdbcCatalog, or RESTCatalog.","Guard the call: only pass metadata when the catalog supports it."],"exampleFix":"// before\ncatalog.createNamespace(ns, ImmutableMap.of(\"comment\", \"sales data\"));\n\n// after\nif (catalog instanceof HadoopCatalog) {\n  catalog.createNamespace(ns, Collections.emptyMap());\n} else {\n  catalog.createNamespace(ns, metadata);\n}","handlingStrategy":"validation","validationCode":"if (meta != null && !meta.isEmpty()) { throw new IllegalArgumentException(\"HadoopCatalog does not support namespace metadata\"); }","typeGuard":null,"tryCatchPattern":"try { catalog.createNamespace(ns, meta); } catch (UnsupportedOperationException e) { catalog.createNamespace(ns, Collections.emptyMap()); }","preventionTips":["Pass empty metadata maps to HadoopCatalog","Branch namespace-property code on catalog type","Prefer Hive/JDBC/REST catalogs when properties are needed"],"tags":["unsupported-operation","namespace","metadata","hadoop-catalog"],"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"}