apache/iceberg · warning · UnsupportedOperationException

SnowflakeCatalog does not currently support createNamespace

Error message

SnowflakeCatalog does not currently support createNamespace

What it means

SnowflakeCatalog.createNamespace is unimplemented and always throws UnsupportedOperationException. Databases and schemas cannot be created through this catalog; namespace provisioning must happen in Snowflake.

Source

Thrown at snowflake/src/main/java/org/apache/iceberg/snowflake/SnowflakeCatalog.java:173

    this.snowflakeClient = snowflakeClient;
    this.fileIOFactory = fileIOFactory;
    this.catalogProperties = properties;
    this.closeableGroup = new CloseableGroup();
    closeableGroup.addCloseable(snowflakeClient);
    closeableGroup.addCloseable(metricsReporter());
    closeableGroup.setSuppressCloseFailure(true);
  }

  @Override
  public void close() throws IOException {
    if (null != closeableGroup) {
      closeableGroup.close();
    }
  }

  @Override
  public void createNamespace(Namespace namespace, Map<String, String> metadata) {
    throw new UnsupportedOperationException(
        "SnowflakeCatalog does not currently support createNamespace");
  }

  @Override
  public List<Namespace> listNamespaces(Namespace namespace) {
    SnowflakeIdentifier scope = NamespaceHelpers.toSnowflakeIdentifier(namespace);
    List<SnowflakeIdentifier> results;
    switch (scope.type()) {
      case ROOT:
        results = snowflakeClient.listDatabases();
        break;
      case DATABASE:
        results = snowflakeClient.listSchemas(scope);
        break;
      default:
        throw new IllegalArgumentException(
            String.format(
                "listNamespaces must be at either ROOT or DATABASE level; got %s from namespace %s",

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Create the Snowflake database/schema via Snowflake SQL or the Snowflake driver before using the catalog
  2. Skip namespace-creation steps for SnowflakeCatalog in generic workflows
  3. Catch UnsupportedOperationException and route creation to Snowflake-side tooling

Example fix

// before
catalog.createNamespace(Namespace.of("db", "schema"), Collections.emptyMap());
// after
// executed beforehand via Snowflake:
// CREATE SCHEMA IF NOT EXISTS db.schema;
catalog.loadNamespaceMetadata(Namespace.of("db", "schema"));
Defensive patterns

Strategy: try-catch

Validate before calling

if (catalog instanceof SnowflakeCatalog) {
  // create database/schema via Snowflake SQL first
}

Type guard

boolean supportsCreateNamespace(Catalog c) {
  return !(c instanceof SnowflakeCatalog);
}

Try / catch

try {
  catalog.createNamespace(ns, metadata);
} catch (UnsupportedOperationException e) {
  // CREATE SCHEMA via Snowflake, then verify with loadNamespaceMetadata
}

Prevention

When it happens

Trigger: Any invocation of catalog.createNamespace(namespace, metadata) on SnowflakeCatalog, including Spark CREATE (DATABASE|SCHEMA) or namespace-creating engines/workflows.

Common situations: Bootstrap scripts that create namespaces before writing tables; generic catalog provisioning tools; tests that assume catalogs support namespace creation.

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