apache/iceberg · error · NoSuchViewException

View not found: ${fromIdentifier}

Error message

View not found: ${fromIdentifier}

What it means

renameView() translates a core NoSuchViewException from ViewCatalog.renameView into a Spark NoSuchViewException naming the source identifier. It means the FROM view of the rename does not exist in the catalog. The TO name may be fine; only the source lookup failed.

Source

Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:758

  }

  @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);

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

    boolean cacheCaseSensitive =

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Confirm the source view exists (SHOW VIEWS / listViews) using the exact namespace and name
  2. Fix the fromIdentifier spelling/case or the default namespace in the Spark session
  3. Recreate the view if it was dropped before retrying the rename

Example fix

// before
spark.sql("ALTER VIEW analytics.daly_rev RENAME TO analytics.daily_revenue");
// after
spark.sql("ALTER VIEW analytics.daily_rev RENAME TO analytics.daily_revenue");
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure source view exists before renaming
boolean exists = ((org.apache.iceberg.catalog.ViewCatalog) catalog)
    .viewExists(org.apache.iceberg.catalog.TableIdentifier.of(fromNs, fromName));
if (!exists) {
  throw new IllegalStateException("Cannot rename: view " + fromName + " not found");
}

Type guard

boolean sourceExists(org.apache.iceberg.catalog.ViewCatalog vc, Identifier ident) {
  try {
    vc.loadView(org.apache.iceberg.catalog.TableIdentifier.of(ident.namespace().levels(), ident.name()));
    return true;
  } catch (org.apache.iceberg.exceptions.NoSuchViewException e) {
    return false;
  }
}

Try / catch

try {
  catalog.renameView(from, to);
} catch (NoSuchViewException e) {
  logger.error("Source view {} not found; verify namespace and name", from, e);
}

Prevention

When it happens

Trigger: Calling SparkCatalog.renameView(fromIdentifier, toIdentifier) (ALTER VIEW ... RENAME TO) when the catalog throws org.apache.iceberg.exceptions.NoSuchViewException for buildIdentifier(fromIdentifier).

Common situations: Misspelled or stale view name in migration scripts; view dropped concurrently by another job; rename issued against a namespace where the view was never created; case mismatch on name-sensitive catalogs.

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