apache/iceberg · error · NoSuchNamespaceException

Namespace does not exist: %s

Error message

Namespace does not exist: %s

What it means

NoSuchNamespaceException from InMemoryCatalog.setProperties: an attempt to set namespace properties targeted a namespace that does not exist in the in-memory catalog. The %s is the offending Namespace; the guard fires before any property is applied.

Source

Thrown at core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java:251

            "Namespace %s is not empty. Contains %d table(s).", namespace, tableIdentifiers.size());
      }

      List<TableIdentifier> viewIdentifiers = listViews(namespace);
      if (!viewIdentifiers.isEmpty()) {
        throw new NamespaceNotEmptyException(
            "Namespace %s is not empty. Contains %d view(s).", namespace, viewIdentifiers.size());
      }

      return namespaces.remove(namespace) != null;
    }
  }

  @Override
  public boolean setProperties(Namespace namespace, Map<String, String> properties)
      throws NoSuchNamespaceException {
    synchronized (this) {
      if (!namespaceExists(namespace)) {
        throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
      }

      namespaces.computeIfPresent(
          namespace,
          (k, v) ->
              ImmutableMap.<String, String>builder()
                  .putAll(v)
                  .putAll(properties)
                  .buildKeepingLast());

      return true;
    }
  }

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

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Call createNamespace(ns) first, or verify with namespaceExists(ns)
  2. Check the namespace name for typos and exact case of each level
  3. Re-create the namespace if it was dropped concurrently

Example fix

// before
catalog.setProperties(ns, props);
// after
if (!catalog.namespaceExists(ns)) {
  catalog.createNamespace(ns);
}
catalog.setProperties(ns, props);
Defensive patterns

Strategy: validation

Validate before calling

if (!catalog.namespaceExists(ns)) catalog.createNamespace(ns);

Try / catch

try { catalog.setProperties(ns, props); } catch (NoSuchNamespaceException e) { catalog.createNamespace(ns); catalog.setProperties(ns, props); }

Prevention

When it happens

Trigger: Calling catalog.setProperties(ns, props) for a namespace never created or already dropped.

Common situations: Typo in namespace level (case-sensitive levels); namespace dropped by another process before the update; setting properties before calling createNamespace.

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