apache/iceberg · error · NoSuchViewException
NoSuchViewException(fromIdentifier)
Error message
NoSuchViewException(fromIdentifier)
What it means
Thrown by SparkCatalog.renameView when the underlying Iceberg view catalog reports that the source view does not exist. Spark translates org.apache.iceberg.exceptions.NoSuchViewException into Spark's NoSuchViewException for the fromIdentifier, aborting the rename.
Source
Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:782
}
@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
- Verify the source view exists (SHOW VIEWS) before renaming
- Correct the source identifier's namespace/name
- Ensure the statement targets the catalog that actually holds the view
Example fix
// before ALTER VIEW catalog.db.old_view RENAME TO catalog.db.new_view; // view missing // after CREATE OR REPLACE VIEW catalog.db.old_view AS SELECT 1; // recreate, then rename ALTER VIEW catalog.db.old_view RENAME TO catalog.db.new_view;
Defensive patterns
Strategy: try-catch
Validate before calling
if (!spark.catalog().viewExists("catalog", "db", "from")) { throw new IllegalStateException("source view missing"); } Try / catch
try {
catalog.renameView(fromIdent, toIdent);
} catch (NoSuchViewException e) {
// handle missing source: recreate or abort
} Prevention
- List views with SHOW VIEWS before rename operations
- Pin the exact catalog in statements to avoid cross-catalog lookups
- Guard migration scripts against already-renamed sources
When it happens
Trigger: ALTER VIEW from RENAME TO to (Spark 3.4+ / Iceberg view support) where fromIdentifier names no existing view in asViewCatalog.
Common situations: Renaming a view that was dropped; typos in the source name; wrong namespace; view exists in a different catalog than the one Spark is addressing.
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
- View does not exist: fromIdentifier
- View not found: ${fromIdentifier}
- Cannot rename %s to %s. View does not exist
- View does not exist
- View does not exist: %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/4894660391cf020b.
Report an issue: GitHub.