apache/iceberg · error · NoSuchViewException

View does not exist: ident

Error message

View does not exist: ident

What it means

Thrown by SparkSessionCatalog.loadView when neither the Iceberg view catalog (asViewCatalog) nor the delegate session catalog contains a view with the given identifier. loadView first checks its own view catalog, then the session catalog when this catalog is the view catalog; failing both, it reports NoSuchViewException.

Source

Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:455

    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(
      Identifier ident,
      String sql,
      String currentCatalog,
      String[] currentNamespace,
      StructType schema,
      String[] queryColumnNames,
      String[] columnAliases,
      String[] columnComments,
      Map<String, String> properties)
      throws ViewAlreadyExistsException, NoSuchNamespaceException {
    if (null != asViewCatalog) {
      return asViewCatalog.createView(
          ident,
          sql,

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Confirm the view exists: SHOW VIEWS IN <namespace> / catalog.viewExists with the exact identifier.
  2. Qualify the view with the correct catalog name in SQL (catalog.db.view).
  3. Recreate the view if it was dropped.
  4. Ensure the configured catalog supports views (ViewCatalog) and the session delegate is wired correctly.

Example fix

// before
Dataset<Row> df = spark.read().table("prod.metrics.daily"); // view not in prod catalog
// after
Dataset<Row> df = spark.read().table("reports.metrics.daily"); // catalog that actually holds the view
Defensive patterns

Strategy: try-catch

Validate before calling

if (!catalog.viewExists(ident) && !sessionCatalog.viewExists(ident)) { throw new IllegalStateException("view not found in any catalog: " + ident); }

Try / catch

try { View v = catalog.loadView(ident); } catch (NoSuchViewException e) { log.error("view {} not found; check catalog prefix", ident, e); }

Prevention

When it happens

Trigger: Calling loadView(ident) (or SELECT on a view) where asViewCatalog.viewExists(ident) is false and getSessionCatalog().viewExists(ident) is false — the view was never created, was dropped, or lives in a different catalog/namespace than queried.

Common situations: Querying a view with a wrong catalog prefix (view created in another Spark catalog); misspelled view name; view dropped by a cleanup job; referencing an Iceberg view through a session catalog that doesn't implement view storage.

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/449c46cf1e71ff11. Report an issue: GitHub.