apache/iceberg · error · RuntimeException
Failed to list all namespace: <namespace> in Hive Metastore
Error message
Failed to list all namespace: <namespace> in Hive Metastore
What it means
listNamespaces wraps a generic Thrift TException from getAllDatabases() in a RuntimeException stating the namespaces could not be listed in the Hive Metastore. This indicates a metastore client/server failure rather than a logical namespace problem.
Source
Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:582
@Override
public List<Namespace> listNamespaces(Namespace namespace) {
if (!namespace.isEmpty() && (!isValidateNamespace(namespace) || !namespaceExists(namespace))) {
throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
}
if (!namespace.isEmpty()) {
return ImmutableList.of();
}
try {
List<Namespace> namespaces =
clients.run(IMetaStoreClient::getAllDatabases).stream()
.map(Namespace::of)
.collect(Collectors.toList());
LOG.debug("Listing namespace {} returned tables: {}", namespace, namespaces);
return namespaces;
} catch (TException e) {
throw new RuntimeException(
"Failed to list all namespace: " + namespace + " in Hive Metastore", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(
"Interrupted in call to getAllDatabases() " + namespace + " in Hive Metastore", e);
}
}
@Override
public boolean dropNamespace(Namespace namespace) {
if (!isValidateNamespace(namespace)) {
return false;
}
try {
clients.run(
client -> {View on GitHub (pinned to 86d9c8fc54)
Solutions
- Inspect the chained cause for the actual TException and check metastore health/connectivity
- Verify catalog configuration (hive.metastore.uris) and authentication credentials
- Retry the listing; HiveCatalog's retry client may already have exhausted internal retries
Defensive patterns
Strategy: retry
Validate before calling
// probe metastore health before bulk listing client.getAllDatabases();
Try / catch
try {
return catalog.listNamespaces();
} catch (RuntimeException e) {
throw new RuntimeException("Metastore listing failed, cause: " + e.getCause(), e);
} Prevention
- Monitor metastore availability
- Validate hive.metastore.uris and auth config
- Add bounded retry with backoff for transient thrift errors
When it happens
Trigger: catalog.listNamespaces() when the Hive Metastore call throws TException — connectivity loss, metastore down, or thrift protocol errors.
Common situations: Metastore service restarted mid-query; network partition to the metastore; misconfigured thrift URI; Kerberos token expiry.
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 check table existence of ${baseTableIdentifier}
- Failed to check view existence of ${viewIdentifier}
- Failed to create namespace ${namespace} in Hive Metastore
- Failed to drop namespace <namespace> in Hive Metastore
- Failed to list namespace under namespace: <namespace> in Hiv
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/c0b18857b77f1284.
Report an issue: GitHub.