{"record":{"id":"c0b18857b77f1284","repo":"apache/iceberg","slug":"failed-to-list-all-namespace-namespace-in-hive","errorCode":null,"errorMessage":"Failed to list all namespace: <namespace> in Hive Metastore","messagePattern":"Failed to list all namespace: <namespace> in Hive Metastore","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java","lineNumber":582,"sourceCode":"  @Override\n  public List<Namespace> listNamespaces(Namespace namespace) {\n    if (!namespace.isEmpty() && (!isValidateNamespace(namespace) || !namespaceExists(namespace))) {\n      throw new NoSuchNamespaceException(\"Namespace does not exist: %s\", namespace);\n    }\n    if (!namespace.isEmpty()) {\n      return ImmutableList.of();\n    }\n    try {\n      List<Namespace> namespaces =\n          clients.run(IMetaStoreClient::getAllDatabases).stream()\n              .map(Namespace::of)\n              .collect(Collectors.toList());\n\n      LOG.debug(\"Listing namespace {} returned tables: {}\", namespace, namespaces);\n      return namespaces;\n\n    } catch (TException e) {\n      throw new RuntimeException(\n          \"Failed to list all namespace: \" + namespace + \" in Hive Metastore\", e);\n\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\n          \"Interrupted in call to getAllDatabases() \" + namespace + \" in Hive Metastore\", e);\n    }\n  }\n\n  @Override\n  public boolean dropNamespace(Namespace namespace) {\n    if (!isValidateNamespace(namespace)) {\n      return false;\n    }\n\n    try {\n      clients.run(\n          client -> {","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L564-L600","documentation":"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.","triggerScenarios":"catalog.listNamespaces() when the Hive Metastore call throws TException — connectivity loss, metastore down, or thrift protocol errors.","commonSituations":"Metastore service restarted mid-query; network partition to the metastore; misconfigured thrift URI; Kerberos token expiry.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// probe metastore health before bulk listing\nclient.getAllDatabases();","typeGuard":null,"tryCatchPattern":"try {\n  return catalog.listNamespaces();\n} catch (RuntimeException e) {\n  throw new RuntimeException(\"Metastore listing failed, cause: \" + e.getCause(), e);\n}","preventionTips":["Monitor metastore availability","Validate hive.metastore.uris and auth config","Add bounded retry with backoff for transient thrift errors"],"tags":["hive-metastore","thrift","listing","connectivity"],"backgroundTag":"database-query-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}