apache/iceberg · warning · UnsupportedOperationException

Cannot remove properties " + namespace + " : removePropertie

Error message

Cannot remove properties " + namespace + " : removeProperties is not supported

What it means

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.

Source

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

      if (fs.listStatusIterator(nsPath).hasNext()) {
        throw new NamespaceNotEmptyException("Namespace %s is not empty.", namespace);
      }

      return fs.delete(nsPath, false /* recursive */);
    } catch (IOException e) {
      throw new RuntimeIOException(e, "Namespace delete failed: %s", namespace);
    }
  }

  @Override
  public boolean setProperties(Namespace namespace, Map<String, String> properties) {
    throw new UnsupportedOperationException(
        "Cannot set namespace properties " + namespace + " : setProperties is not supported");
  }

  @Override
  public boolean removeProperties(Namespace namespace, Set<String> properties) {
    throw new UnsupportedOperationException(
        "Cannot remove properties " + namespace + " : removeProperties is not supported");
  }

  @Override
  public Map<String, String> loadNamespaceMetadata(Namespace namespace) {
    Path nsPath = new Path(warehouseLocation, SLASH.join(namespace.levels()));

    if (!isNamespace(nsPath) || namespace.isEmpty()) {
      throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
    }

    return ImmutableMap.of("location", nsPath.toString());
  }

  private boolean isNamespace(Path path) {
    return isDirectory(path) && !isTableDir(path);
  }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Use a catalog that supports namespace properties (HiveCatalog, JDBC, REST) if removal is required.
  2. Drop the removeProperties call; it can never succeed on HadoopCatalog.
  3. Catch UnsupportedOperationException when writing cross-catalog code.
  4. Clean up by dropping and recreating the namespace if properties were stored out-of-band.

Example fix

// before
catalog.removeProperties(Namespace.of("db"), ImmutableSet.of("owner"));
// after
if (!(catalog instanceof HadoopCatalog)) {
  catalog.removeProperties(Namespace.of("db"), ImmutableSet.of("owner"));
}
Defensive patterns

Strategy: fallback

Validate before calling

if (catalog instanceof HadoopCatalog) {
  // skip removeProperties: unsupported
}

Type guard

boolean supportsNsProps = !(catalog instanceof HadoopCatalog);

Try / catch

try {
  catalog.removeProperties(ns, keys);
} catch (UnsupportedOperationException e) {
  LOG.warn("removeProperties unsupported on {}", catalog.getClass().getSimpleName());
}

Prevention

When it happens

Trigger: Calling catalog.removeProperties(namespace, props) on a HadoopCatalog, e.g. when generically cleaning up namespace metadata through the SupportsNamespaces interface.

Common situations: 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.

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/a0af1287b3e89f4a. Report an issue: GitHub.