{"record":{"id":"86bc0736e9e79e67","repo":"apache/iceberg","slug":"snowflakecatalog-does-not-currently-support-create","errorCode":null,"errorMessage":"SnowflakeCatalog does not currently support createNamespace","messagePattern":"SnowflakeCatalog does not currently support createNamespace","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"snowflake/src/main/java/org/apache/iceberg/snowflake/SnowflakeCatalog.java","lineNumber":173,"sourceCode":"    this.snowflakeClient = snowflakeClient;\n    this.fileIOFactory = fileIOFactory;\n    this.catalogProperties = properties;\n    this.closeableGroup = new CloseableGroup();\n    closeableGroup.addCloseable(snowflakeClient);\n    closeableGroup.addCloseable(metricsReporter());\n    closeableGroup.setSuppressCloseFailure(true);\n  }\n\n  @Override\n  public void close() throws IOException {\n    if (null != closeableGroup) {\n      closeableGroup.close();\n    }\n  }\n\n  @Override\n  public void createNamespace(Namespace namespace, Map<String, String> metadata) {\n    throw new UnsupportedOperationException(\n        \"SnowflakeCatalog does not currently support createNamespace\");\n  }\n\n  @Override\n  public List<Namespace> listNamespaces(Namespace namespace) {\n    SnowflakeIdentifier scope = NamespaceHelpers.toSnowflakeIdentifier(namespace);\n    List<SnowflakeIdentifier> results;\n    switch (scope.type()) {\n      case ROOT:\n        results = snowflakeClient.listDatabases();\n        break;\n      case DATABASE:\n        results = snowflakeClient.listSchemas(scope);\n        break;\n      default:\n        throw new IllegalArgumentException(\n            String.format(\n                \"listNamespaces must be at either ROOT or DATABASE level; got %s from namespace %s\",","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/snowflake/src/main/java/org/apache/iceberg/snowflake/SnowflakeCatalog.java#L155-L191","documentation":"SnowflakeCatalog.createNamespace is unimplemented and always throws UnsupportedOperationException. Databases and schemas cannot be created through this catalog; namespace provisioning must happen in Snowflake.","triggerScenarios":"Any invocation of catalog.createNamespace(namespace, metadata) on SnowflakeCatalog, including Spark CREATE (DATABASE|SCHEMA) or namespace-creating engines/workflows.","commonSituations":"Bootstrap scripts that create namespaces before writing tables; generic catalog provisioning tools; tests that assume catalogs support namespace creation.","solutions":["Create the Snowflake database/schema via Snowflake SQL or the Snowflake driver before using the catalog","Skip namespace-creation steps for SnowflakeCatalog in generic workflows","Catch UnsupportedOperationException and route creation to Snowflake-side tooling"],"exampleFix":"// before\ncatalog.createNamespace(Namespace.of(\"db\", \"schema\"), Collections.emptyMap());\n// after\n// executed beforehand via Snowflake:\n// CREATE SCHEMA IF NOT EXISTS db.schema;\ncatalog.loadNamespaceMetadata(Namespace.of(\"db\", \"schema\"));","handlingStrategy":"try-catch","validationCode":"if (catalog instanceof SnowflakeCatalog) {\n  // create database/schema via Snowflake SQL first\n}","typeGuard":"boolean supportsCreateNamespace(Catalog c) {\n  return !(c instanceof SnowflakeCatalog);\n}","tryCatchPattern":"try {\n  catalog.createNamespace(ns, metadata);\n} catch (UnsupportedOperationException e) {\n  // CREATE SCHEMA via Snowflake, then verify with loadNamespaceMetadata\n}","preventionTips":["Provision Snowflake databases/schemas before catalog use","Skip namespace-creation steps for read-oriented catalogs","Verify namespaces exist with loadNamespaceMetadata after external creation","Make bootstrap scripts catalog-type aware"],"tags":["snowflake","unsupported-operation","catalog","namespace"],"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"}