apache/iceberg · error · NoSuchViewException

NoSuchViewException(ident)

Error message

NoSuchViewException(ident)

What it means

Thrown by SparkSessionCatalog.loadView when neither the Iceberg view catalog nor the session catalog reports viewExists(ident) true, so the requested view cannot be resolved anywhere. Analogous to NoSuchTableException but for views.

Source

Thrown at spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:456

    return new Identifier[0];
  }

  @Override
  public boolean viewExists(Identifier ident) {
    return (asViewCatalog != null && asViewCatalog.viewExists(ident))
        || (isViewCatalog() && getSessionCatalog().viewExists(ident));
  }

  @Override
  public View loadView(Identifier ident) throws NoSuchViewException {
    if (null != asViewCatalog && asViewCatalog.viewExists(ident)) {
      return asViewCatalog.loadView(ident);
    } else if (isViewCatalog() && getSessionCatalog().viewExists(ident)) {
      return getSessionCatalog().loadView(ident);
    }

    throw new NoSuchViewException(ident);
  }

  @Override
  public View createView(ViewInfo viewInfo)
      throws ViewAlreadyExistsException, NoSuchNamespaceException {
    if (viewInfo == null) {
      return null;
    }

    if (null != asViewCatalog) {
      return asViewCatalog.createView(viewInfo);
    } else if (isViewCatalog()) {
      return getSessionCatalog().createView(viewInfo);
    }

    throw new UnsupportedOperationException(
        "Creating a view is not supported by catalog: " + catalogName);
  }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check the fully qualified view identifier and the catalog it lives in (SHOW VIEWS IN <catalog>.<ns>).
  2. Recreate the view if it was dropped, or create it with CREATE VIEW.
  3. Ensure view support is available: the session catalog must be a ViewCatalog or an Iceberg ViewCatalog must be configured.

Example fix

// before
SELECT * FROM prod.db.report_view  -- view never created
// after
CREATE VIEW prod.db.report_view AS SELECT ...;
SELECT * FROM prod.db.report_view
Defensive patterns

Strategy: validation

Validate before calling

if (!catalog.viewExists(Identifier.of(new String[] {"db"}, "report_view"))) {
  throw new IllegalArgumentException("view does not exist");
}

Type guard

boolean viewResolvable(ViewCatalog c, Identifier ident) { return c.viewExists(ident); }

Try / catch

try { catalog.loadView(ident); } catch (NoSuchViewException e) { /* create the view or fix identifier */ }

Prevention

When it happens

Trigger: SELECT or DESCRIBE VIEW on a view identifier that does not exist in the configured view catalog nor in the delegate session catalog.

Common situations: View created in a different catalog than the one queried; view dropped or renamed by another process; case-sensitivity mismatch in view name; view support not configured (no view catalog registered).

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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