apache/iceberg · error · UnsupportedOperationException

Cannot create namespace " + namespace + ": metadata is not s

Error message

Cannot create namespace " + namespace + ": metadata is not supported

What it means

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.

Source

Thrown at core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java:284

        }
        return fs.delete(tablePath, true /* recursive */);
      }
    } catch (IOException e) {
      throw new RuntimeIOException(e, "Failed to delete file: %s", tablePath);
    }
  }

  @Override
  public void renameTable(TableIdentifier from, TableIdentifier to) {
    throw new UnsupportedOperationException("Cannot rename Hadoop tables");
  }

  @Override
  public void createNamespace(Namespace namespace, Map<String, String> meta) {
    Preconditions.checkArgument(
        !namespace.isEmpty(), "Cannot create namespace with invalid name: %s", namespace);
    if (!meta.isEmpty()) {
      throw new UnsupportedOperationException(
          "Cannot create namespace " + namespace + ": metadata is not supported");
    }

    Path nsPath = new Path(warehouseLocation, SLASH.join(namespace.levels()));

    if (isNamespace(nsPath)) {
      throw new AlreadyExistsException("Namespace already exists: %s", namespace);
    }

    try {
      fs.mkdirs(nsPath);

    } catch (IOException e) {
      throw new RuntimeIOException(e, "Create namespace failed: %s", namespace);
    }
  }

  @Override

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Pass an empty map (Collections.emptyMap()) to createNamespace on HadoopCatalog.
  2. Remove namespace property-setting code paths when targeting the Hadoop catalog.
  3. If namespace properties are required, switch to HiveCatalog, JdbcCatalog, or RESTCatalog.
  4. Guard the call: only pass metadata when the catalog supports it.

Example fix

// before
catalog.createNamespace(ns, ImmutableMap.of("comment", "sales data"));

// after
if (catalog instanceof HadoopCatalog) {
  catalog.createNamespace(ns, Collections.emptyMap());
} else {
  catalog.createNamespace(ns, metadata);
}
Defensive patterns

Strategy: validation

Validate before calling

if (meta != null && !meta.isEmpty()) { throw new IllegalArgumentException("HadoopCatalog does not support namespace metadata"); }

Try / catch

try { catalog.createNamespace(ns, meta); } catch (UnsupportedOperationException e) { catalog.createNamespace(ns, Collections.emptyMap()); }

Prevention

When it happens

Trigger: Calling catalog.createNamespace(namespace, meta) where meta is non-empty (e.g. porting code from HiveCatalog that sets namespace comments or properties).

Common situations: Migrating from Hive/Glue catalogs to HadoopCatalog while reusing namespace-creation code that carries properties; generic catalog tooling that always forwards a metadata map.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/c2a29878400e011f. Report an issue: GitHub.