apache/iceberg · error · RuntimeException
Failed to list all views under namespace ${namespace}
Error message
Failed to list all views under namespace ${namespace} What it means
listViews() wraps a Thrift TException from the Hive Metastore in a RuntimeException with this message when listing views fails at the RPC/protocol level. It indicates a metastore communication or server-side failure rather than a missing namespace.
Source
Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:229
String database = namespace.level(0);
List<String> viewNames =
clients.run(client -> client.getTables(database, "*", TableType.VIRTUAL_VIEW));
// Retrieving the Table objects from HMS in batches to avoid OOM
List<TableIdentifier> filteredTableIdentifiers = Lists.newArrayList();
Iterable<List<String>> viewNameSets = Iterables.partition(viewNames, 100);
for (List<String> viewNameSet : viewNameSets) {
filteredTableIdentifiers.addAll(
listIcebergTables(viewNameSet, namespace, HiveOperationsBase.ICEBERG_VIEW_TYPE_VALUE));
}
return filteredTableIdentifiers;
} catch (UnknownDBException e) {
throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
} catch (TException e) {
throw new RuntimeException("Failed to list all views under namespace " + namespace, e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Interrupted in call to listViews", e);
}
}
@Override
public String name() {
return name;
}
@Override
public boolean dropTable(TableIdentifier identifier, boolean purge) {
if (!isValidIdentifier(identifier)) {
return false;
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Check metastore availability and connectivity (metastore URI, ping the service).
- Inspect the chained cause (e.getCause()) for the concrete TException detail.
- Align Hive/metastore client versions with the server's Thrift protocol.
- Retry with backoff; transient metastore hiccups commonly produce this.
Example fix
// before
List<ViewIdentifier> views = catalog.listViews(ns);
// after
try {
List<ViewIdentifier> views = catalog.listViews(ns);
} catch (RuntimeException e) {
if (e.getCause() instanceof TException) {
LOG.warn("Metastore RPC failed listing views in {}", ns, e);
// retry or fail over
}
} Defensive patterns
Strategy: retry
Validate before calling
// No local check can detect a metastore RPC failure in advance; verify connectivity out of band: // metastore URI reachable, e.g. nc -z <host> <port>
Try / catch
try {
views = catalog.listViews(ns);
} catch (RuntimeException e) {
if (e.getCause() instanceof TException) {
// retry with exponential backoff, bounded attempts
}
throw e;
} Prevention
- Monitor metastore health and add retries with backoff for Thrift calls.
- Keep Hive client versions aligned with the metastore server.
- Set explicit timeouts on the metastore connection so hangs fail fast.
When it happens
Trigger: Calling catalog.listViews(namespace) and the Hive Metastore throws a TException — e.g. metastore connection dropped, Thrift protocol mismatch, or metastore-side error while fetching table list filtered by ICEBERG_VIEW_TYPE_VALUE.
Common situations: Metastore is down or restarting; network partition/firewall between client and metastore; incompatible Hive client/library versions speaking different Thrift protocols; metastore timeout under load.
Related errors
- Failed to drop ${identifier}
- Failed to drop view ${identifier}
- Metastore operation failed for %s.%s
- Interrupted in call to listViews
- Interrupted in call to dropView
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/e778c4e6139f6777.
Report an issue: GitHub.