apache/iceberg · error · NoSuchViewException
View does not exist:
Error message
View does not exist:
What it means
loadView in SparkSessionCatalog throws NoSuchViewException when neither the delegate view catalog nor the session catalog reports the view as existing. The catalog first checks the configured Iceberg view catalog, then the session catalog, and fails if both miss.
Source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:497
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
- Verify the view name and namespace with SHOW VIEWS in the target catalog
- Create the view or point the session at the catalog/namespace where it exists (USE catalog.namespace)
- Catch NoSuchViewException in code and fall back to creating the view or erroring with a clear message
Example fix
// before
View v = sessionCatalog.loadView(ident); // throws
// after
if (sessionCatalog.viewExists(ident)) {
View v = sessionCatalog.loadView(ident);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (sessionCatalog.viewExists(ident)) {
View v = sessionCatalog.loadView(ident);
} Try / catch
try {
View v = catalog.loadView(ident);
} catch (NoSuchViewException e) {
// create the view or surface a clear 'view missing' message
} Prevention
- Confirm the view's catalog and namespace with SHOW VIEWS before loading
- Qualify the view with the catalog where it was created
- Guard against concurrent drops when sharing views across jobs
When it happens
Trigger: SELECTing or DESCRIBEing a view that does not exist in either the Iceberg view catalog or the session catalog; view name typo or wrong namespace; view dropped concurrently by another job.
Common situations: Pointing Spark at a catalog where the view lives under a different namespace; using spark_catalog when the view was created under an explicit Iceberg view catalog; migration where views were not copied over.
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
- View does not exist: ident
- NoSuchViewException(ident)
- Cannot list views for namespace. Namespace does not exist: %
- Cannot rename %s to %s. View does not exist
- View does not exist: %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/cdf2b4b7e137216a.
Report an issue: GitHub.