apache/iceberg · error · NoSuchViewException
Cannot rename to . View does not exist
Error message
Cannot rename %s to %s. View does not exist
What it means
Thrown by HiveCatalog.renameTableOrView when the Hive Metastore reports NoSuchObjectException during a view rename, meaning the source view does not exist. Iceberg translates this into NoSuchViewException, mirroring the table case. The rename was aborted because there is no view to move.
Solutions
- Confirm the view exists with catalog.viewExists(from) before renaming.
- Verify the identifier is a view, not a table; use renameTable for tables.
- Check the metastore connection/environment and exact view name casing.
Example fix
// before
catalog.renameView(from, to);
// after
if (catalog.viewExists(from)) {
catalog.renameView(from, to);
} Defensive patterns
Strategy: validation
Validate before calling
if (!catalog.viewExists(from)) { throw new IllegalArgumentException("Source view " + from + " does not exist"); } Try / catch
try { catalog.renameView(from, to); } catch (org.apache.iceberg.exceptions.NoSuchViewException e) { LOG.error("Rename skipped: view {} not found", from, e); } Prevention
- Check viewExists(from) before renaming views
- Use renameTable for tables and renameView for views
- Verify identifier casing against listViews(namespace)
When it happens
Trigger: Calling HiveCatalog.renameView(from, to) where 'from' is not an existing Iceberg view in the metastore, or the identifier points to a table rather than a view.
Common situations: Renaming a view that was already dropped; passing a table identifier to renameView; typo or wrong namespace in the view name; metastore where the Iceberg view metadata was never created.
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
- Cannot rename to . Namespace does not exist
- Cannot rename to . Table does not exist
- View does not exist
- Cannot move view between catalogs: from=
- Cannot rename because destination table exists
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/199e73ced5113920.
Report an issue: GitHub.
Appendix: source
Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:437
validateTableIsIcebergTableOrView(contentType, table, CatalogUtil.fullTableName(name, from));
table.setDbName(toDatabase);
table.setTableName(to.name());
clients.run(
client -> {
MetastoreUtil.alterTable(client, fromDatabase, fromName, table);
return null;
});
LOG.info("Renamed {} from {}, to {}", contentType.value(), from, to);
} catch (NoSuchObjectException e) {
switch (contentType) {
case TABLE:
throw new NoSuchTableException("Cannot rename %s to %s. Table does not exist", from, to);
case VIEW:
throw new NoSuchViewException("Cannot rename %s to %s. View does not exist", from, to);
}
} catch (InvalidOperationException e) {
if (e.getMessage() != null
&& e.getMessage().contains(String.format("new table %s already exists", to))) {
throw new AlreadyExistsException("Table already exists: %s", to);
} else {
throw new RuntimeException("Failed to rename " + from + " to " + to, e);
}
} catch (TException e) {
throw new RuntimeException("Failed to rename " + from + " to " + to, e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Interrupted in call to rename", e);
}
}View on GitHub (pinned to 86d9c8fc54)