apache/iceberg · error · NoSuchViewException

View does not exist: %s

Error message

View does not exist: %s

What it means

Inside the views.compute lambda of the view commit path, if the map entry vanished (existingLocation == null) while committing against a non-null base, the view was dropped concurrently. InMemoryCatalog throws NoSuchViewException since a metadata-location commit against a deleted view cannot proceed.

Source

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

          throw new NoSuchNamespaceException(
              "Cannot create view %s. Namespace does not exist: %s",
              identifier, identifier.namespace());
        }

        if (tables.containsKey(identifier)) {
          throw new AlreadyExistsException("Table with same name already exists: %s", identifier);
        }

        views.compute(
            identifier,
            (k, existingLocation) -> {
              if (!Objects.equal(existingLocation, oldLocation)) {
                if (null == base) {
                  throw new AlreadyExistsException("View already exists: %s", identifier);
                }

                if (null == existingLocation) {
                  throw new NoSuchViewException("View does not exist: %s", identifier);
                }

                throw new CommitFailedException(
                    "Cannot commit to view %s metadata location from %s to %s "
                        + "because it has been concurrently modified to %s",
                    identifier, oldLocation, newLocation, existingLocation);
              }

              return newLocation;
            });
      }
    }

    @Override
    public FileIO io() {
      return io;
    }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Re-check catalog.viewExists(ident) before committing view updates.
  2. Catch NoSuchViewException and decide whether to recreate the view or abort the pipeline.
  3. Coordinate drop and update phases so updates are drained before drops.

Example fix

// before
view.updateVersionSummary(...); // commit path

// after
if (catalog.viewExists(ident)) {
  view = catalog.loadView(ident);
  // apply update
} else {
  // view was dropped; recreate or abort
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!catalog.viewExists(ident)) { throw new IllegalStateException("View was dropped: " + ident); }

Try / catch

try { view.updateXXX...commit(); } catch (NoSuchViewException e) { // recreate view or abort; refresh handles are stale }

Prevention

When it happens

Trigger: A view update commit (from catalog.loadView(ident) or a ViewBuilder replace) racing with catalog.dropView(ident): the drop removes the entry before the update's compute step executes.

Common situations: Replace-view flows colliding with drop scripts; cleanup jobs deleting stale views while an update is in flight; test teardown racing with assertion-time updates.

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