apache/iceberg · error · RuntimeException
Failed to list all tables under namespace ${namespace}
Error message
Failed to list all tables under namespace ${namespace} What it means
HiveCatalog.listTables() throws RuntimeException("Failed to list all tables under namespace ...") when the Hive metastore Thrift call fails with a TException other than UnknownDBException. It wraps any transport/protocol-level failure of the listTableNames RPC with the namespace for context.
Source
Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:197
.collect(Collectors.toList());
} else {
// Retrieving only the matching table names from HMS via server-side filter
tableIdentifiers =
listIcebergTablesByFilter(
namespace, BaseMetastoreTableOperations.ICEBERG_TABLE_TYPE_VALUE);
}
LOG.debug(
"Listing of namespace: {} resulted in the following tables: {}",
namespace,
tableIdentifiers);
return tableIdentifiers;
} catch (UnknownDBException e) {
throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
} catch (TException e) {
throw new RuntimeException("Failed to list all tables under namespace " + namespace, e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Interrupted in call to listTables", e);
}
}
@Override
public List<TableIdentifier> listViews(Namespace namespace) {
Preconditions.checkArgument(
isValidateNamespace(namespace), "Missing database in namespace: %s", namespace);
try {
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 OOMView on GitHub (pinned to 86d9c8fc54)
Solutions
- Verify Hive metastore is up and reachable at the configured thrift:// URI
- Check network/firewall and metastore logs for the underlying TException
- Align client Thrift settings (protocol, timeout) with the metastore configuration
- Retry with backoff if the failure is transient (e.g. metastore restart)
Example fix
// before hive.metastore.uris=thrift://metastore:9083 // unreachable // after // verify: nc -zv metastore 9083; fix URI or start metastore service
Defensive patterns
Strategy: retry
Validate before calling
// probe connectivity: new Socket(metastoreHost, 9083) before building catalog
Try / catch
try { catalog.listTables(ns); } catch (RuntimeException e) { /* retry with backoff if transient TException; else fail fast with cause */ } Prevention
- Monitor metastore health and thrift URI correctness
- Set sensible client timeouts
- Keep Thrift protocol settings in sync with HMS
When it happens
Trigger: listTables() call hits HMS via Thrift and receives TException — connection dropped, metastore timeout, Thrift protocol mismatch, or metastore-side error.
Common situations: Metastore down or restarting; wrong metastore URI; network/firewall between client and HMS; Thrift version/protocol mismatch (binary vs HTTP); metastore overloaded/timeouts.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Failed to connect to Hive Metastore
- Failed to reconnect to Hive Metastore
- Metastore operation failed for %s.%s
- Failed to create lock {}
- Failed to get view info from metastore %s.%s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/ecef16a89ce12e10.
Report an issue: GitHub.