apache/iceberg · warning
Failed to load view metadata for view
Error message
Failed to load view metadata for view: {} What it means
HiveCatalog.dropView loads the current view metadata via HiveViewOperations before dropping the backing HMS table. If loading metadata throws NotFoundException (view already absent in the metastore), it logs this warning and continues to call client.dropTable, treating the drop as best-effort. It is not a hard failure; the view may already have been deleted.
Solutions
- Verify the view identifier (namespace and name) is correct with SHOW VIEWS / HiveCatalog.listViews
- Handle the already-absent case gracefully — the drop still proceeds and typically succeeds or throws a familiar 'table not found' from HMS
- If the view should exist, check HMS directly (beeline, describe view) for manual deletion by another job
- Guard with a listViews existence check if strict absence handling is needed
Example fix
// before
catalog.dropView(TableIdentifier.of("db", "report_view"));
// after
if (catalog.viewExists(TableIdentifier.of("db", "report_view"))) {
catalog.dropView(TableIdentifier.of("db", "report_view"));
} Defensive patterns
Strategy: validation
Validate before calling
if (!catalog.viewExists(TableIdentifier.of("db", "my_view"))) { /* skip or handle absent view */ } Try / catch
try { catalog.dropView(id); } catch (org.apache.iceberg.exceptions.NotFoundException e) { /* already gone, treat as success */ } Prevention
- Check viewExists before drop in idempotent cleanup jobs
- Use canonical identifiers (correct namespace/case)
- Handle concurrent drops by tolerating NotFoundException
When it happens
Trigger: Calling HiveCatalog.dropView(identifier) when the view does not exist in the Hive Metastore, or was dropped concurrently by another process between existence check and metadata load.
Common situations: Idempotent cleanup pipelines dropping views that may already be gone; concurrent job conflicts; referencing a view name in the wrong database or with wrong case.
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 list views for namespace. Namespace does not exist
- Cannot rename to . View does not exist
- Could not acquire the lock on
- Could not find lock with HMSClient
- Failed to acquire locks from metastore because the…
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/4207d90ba2fd5be9.
Report an issue: GitHub.
Appendix: source
Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:309
}
}
@Override
public boolean dropView(TableIdentifier identifier) {
if (!isValidIdentifier(identifier)) {
return false;
}
try {
String database = identifier.namespace().level(0);
String viewName = identifier.name();
HiveViewOperations ops = (HiveViewOperations) newViewOps(identifier);
ViewMetadata lastViewMetadata = null;
try {
lastViewMetadata = ops.current();
} catch (NotFoundException e) {
LOG.warn("Failed to load view metadata for view: {}", identifier, e);
}
clients.run(
client -> {
client.dropTable(database, viewName, false, false);
return null;
});
if (lastViewMetadata != null) {
CatalogUtil.dropViewMetadata(ops.io(), lastViewMetadata);
}
LOG.info("Dropped view: {}", identifier);
return true;
} catch (NoSuchObjectException e) {
LOG.info("Skipping drop, view does not exist: {}", identifier, e);
return false;
} catch (TException e) {View on GitHub (pinned to 86d9c8fc54)