apache/iceberg · error · NoSuchViewException

View does not exist: fromIdentifier

Error message

View does not exist: fromIdentifier

What it means

Thrown by SparkCatalog.renameView when the underlying view catalog reports that the source view (fromIdentifier) does not exist. It is a translation of org.apache.iceberg.exceptions.NoSuchViewException into Spark's NoSuchViewException so the Spark engine can surface it consistently. The rename is aborted; the target view is not created or modified.

Source

Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:755

  }

  @Override
  public boolean dropView(Identifier ident) {
    if (null != asViewCatalog) {
      return asViewCatalog.dropView(buildIdentifier(ident));
    }

    return false;
  }

  @Override
  public void renameView(Identifier fromIdentifier, Identifier toIdentifier)
      throws NoSuchViewException, ViewAlreadyExistsException {
    if (null != asViewCatalog) {
      try {
        asViewCatalog.renameView(buildIdentifier(fromIdentifier), buildIdentifier(toIdentifier));
      } catch (org.apache.iceberg.exceptions.NoSuchViewException e) {
        throw new NoSuchViewException(fromIdentifier);
      } catch (org.apache.iceberg.exceptions.AlreadyExistsException e) {
        throw new ViewAlreadyExistsException(toIdentifier);
      }
    } else {
      throw new UnsupportedOperationException(
          "Renaming a view is not supported by catalog: " + catalogName);
    }
  }

  @Override
  public final void initialize(String name, CaseInsensitiveStringMap options) {
    super.initialize(name, options);

    this.cacheEnabled =
        PropertyUtil.propertyAsBoolean(
            options, CatalogProperties.CACHE_ENABLED, CatalogProperties.CACHE_ENABLED_DEFAULT);

    boolean cacheCaseSensitive =

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Verify the source view exists before renaming: run SHOW VIEWS / catalog.viewExists(fromIdentifier) or list views in the namespace.
  2. Check that the identifier's namespace/catalog prefix points at the catalog that actually holds the view.
  3. Recreate the view if it was dropped, then retry the rename.
  4. Confirm the Iceberg catalog implementation in the Spark conf supports views (ViewCatalog); if not, use a catalog that does.

Example fix

// before
spark.sql("ALTER VIEW analytics.daily RENAME TO analytics.daily_v2");
// after
if (catalog.viewExists(new Identifier(new String[]{"analytics"}, "daily"))) {
  spark.sql("ALTER VIEW analytics.daily RENAME TO analytics.daily_v2");
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!catalog.viewExists(fromIdentifier)) { throw new IllegalStateException("source view missing: " + fromIdentifier); }

Try / catch

try { catalog.renameView(from, to); } catch (NoSuchViewException e) { log.error("view {} does not exist", from, e); }

Prevention

When it happens

Trigger: Calling SparkCatalog.renameView(fromIdentifier, toIdentifier) where asViewCatalog is non-null and asViewCatalog.renameView(...) throws NoSuchViewException, i.e. fromIdentifier was never created as a view or was already dropped.

Common situations: Running ALTER VIEW RENAME on a misspelled or dropped view; renaming a table with ALTER VIEW by mistake; operating on a catalog/session mismatch where the view exists in a different catalog; views lost after a metadata cleanup or catalog re-registration.

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/9ae91c2fc44a588b. Report an issue: GitHub.