apache/iceberg · error · NoSuchViewException

View does not exist: %s

Error message

View does not exist: %s

What it means

BaseMetastoreViewsCatalog.loadView resolves view metadata through ViewOperations for a valid identifier. If ops.current() returns null, no metadata exists in the metastore and the library throws NoSuchViewException — the referenced view does not exist.

Source

Thrown at core/src/main/java/org/apache/iceberg/view/BaseMetastoreViewCatalog.java:61

  protected abstract ViewOperations newViewOps(TableIdentifier identifier);

  @Override
  public void initialize(String name, Map<String, String> properties) {
    super.initialize(name, properties);
  }

  @Override
  public String name() {
    return super.name();
  }

  @Override
  public View loadView(TableIdentifier identifier) {
    if (isValidIdentifier(identifier)) {
      ViewOperations ops = newViewOps(identifier);
      if (ops.current() == null) {
        throw new NoSuchViewException("View does not exist: %s", identifier);
      } else {
        return new BaseView(ops, ViewUtil.fullViewName(name(), identifier));
      }
    }

    throw new NoSuchViewException("Invalid view identifier: %s", identifier);
  }

  @Override
  public ViewBuilder buildView(TableIdentifier identifier) {
    return new BaseViewBuilder(identifier);
  }

  protected class BaseViewBuilder implements ViewBuilder {
    private final TableIdentifier identifier;
    private final Map<String, String> properties = Maps.newHashMap();
    private final List<ViewRepresentation> representations = Lists.newArrayList();
    private Namespace defaultNamespace = null;

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Verify the view exists (catalog.listViews(namespace)) before loading
  2. Check the catalog's warehouse/metastore configuration points at the right location
  3. Use Catalog.loadTable/view existence checks or createOrReplace if the view should exist
Defensive patterns

Strategy: validation

Validate before calling

if (!catalog.viewExists(identifier)) { throw new NoSuchNamespaceException(...); /* or handle */ }

Type guard

boolean viewAvailable(Catalog c, TableIdentifier id) { return c instanceof ViewCatalog && ((ViewCatalog) c).viewExists(id); }

Try / catch

try { return catalog.loadView(identifier); } catch (NoSuchViewException e) { return null; /* create or default */ }

Prevention

When it happens

Trigger: Calling catalog.loadView(TableIdentifier) where the identifier is valid but no view metadata is present in the underlying metastore (never created, dropped, or wrong catalog/warehouse configured).

Common situations: Pointing a catalog at the wrong warehouse/namespace; referencing a view from another catalog; stale code after the view was dropped; typo'd namespace.

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/412b73e482709371. Report an issue: GitHub.