apache/iceberg · error · NoSuchNamespaceException

Namespace '%s' with snowflake identifier '%s' doesn't exist

Error message

Namespace '%s' with snowflake identifier '%s' doesn't exist

What it means

SnowflakeCatalog.loadNamespaceMetadata verified via snowflakeClient that the requested database or schema does not exist and throws NoSuchNamespaceException. Snowflake returns an empty metadata map when the namespace exists; there are no properties to report, so only existence is checked.

Source

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

    SnowflakeIdentifier id = NamespaceHelpers.toSnowflakeIdentifier(namespace);
    boolean namespaceExists;
    switch (id.type()) {
      case DATABASE:
        namespaceExists = snowflakeClient.databaseExists(id);
        break;
      case SCHEMA:
        namespaceExists = snowflakeClient.schemaExists(id);
        break;
      default:
        throw new IllegalArgumentException(
            String.format(
                "loadNamespaceMetadata must be at either DATABASE or SCHEMA level; got %s from namespace %s",
                id, namespace));
    }
    if (namespaceExists) {
      return ImmutableMap.of();
    } else {
      throw new NoSuchNamespaceException(
          "Namespace '%s' with snowflake identifier '%s' doesn't exist", namespace, id);
    }
  }

  @Override
  public boolean dropNamespace(Namespace namespace) {
    throw new UnsupportedOperationException(
        "SnowflakeCatalog does not currently support dropNamespace");
  }

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

  @Override
  public boolean removeProperties(Namespace namespace, Set<String> properties) {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Verify the database/schema exists with SHOW DATABASES / SHOW SCHEMAS in Snowflake using the configured credentials and role
  2. Check catalog configuration (uri, role, database) points at the intended Snowflake account
  3. Ensure the role grants (USAGE on database/schema) allow the connected user to see the namespace
  4. Fix the namespace name spelling/casing in the calling code

Example fix

// before
if (!catalog.namespaceExists(ns)) { /* assume missing */ }
// after
try {
  catalog.loadNamespaceMetadata(ns);
} catch (NoSuchNamespaceException e) {
  // create or locate the correct namespace before proceeding
}
Defensive patterns

Strategy: try-catch

Validate before calling

// optionally pre-check via Snowflake client
boolean exists = namespace.levels().length == 1
    ? snowflakeClient.databaseExists(id)
    : snowflakeClient.schemaExists(id);

Try / catch

try {
  Map<String, String> meta = catalog.loadNamespaceMetadata(ns);
} catch (NoSuchNamespaceException e) {
  // provision the namespace or correct its name before proceeding
}

Prevention

When it happens

Trigger: Calling loadNamespaceMetadata with a one- or two-level namespace whose database (or database.schema) does not exist in the connected Snowflake account, or is not visible to the configured role.

Common situations: Typos in database/schema names or wrong letter-casing assumptions; connected with a role that lacks access to the namespace; pointing the catalog URI at a different Snowflake account/environment than expected; namespace dropped after being cached.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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