{"record":{"id":"ecef16a89ce12e10","repo":"apache/iceberg","slug":"failed-to-list-all-tables-under-namespace-namesp","errorCode":null,"errorMessage":"Failed to list all tables under namespace ${namespace}","messagePattern":"Failed to list all tables under namespace (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java","lineNumber":197,"sourceCode":"                .collect(Collectors.toList());\n      } else {\n        // Retrieving only the matching table names from HMS via server-side filter\n        tableIdentifiers =\n            listIcebergTablesByFilter(\n                namespace, BaseMetastoreTableOperations.ICEBERG_TABLE_TYPE_VALUE);\n      }\n\n      LOG.debug(\n          \"Listing of namespace: {} resulted in the following tables: {}\",\n          namespace,\n          tableIdentifiers);\n      return tableIdentifiers;\n\n    } catch (UnknownDBException e) {\n      throw new NoSuchNamespaceException(\"Namespace does not exist: %s\", namespace);\n\n    } catch (TException e) {\n      throw new RuntimeException(\"Failed to list all tables under namespace \" + namespace, e);\n\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\"Interrupted in call to listTables\", e);\n    }\n  }\n\n  @Override\n  public List<TableIdentifier> listViews(Namespace namespace) {\n    Preconditions.checkArgument(\n        isValidateNamespace(namespace), \"Missing database in namespace: %s\", namespace);\n\n    try {\n      String database = namespace.level(0);\n      List<String> viewNames =\n          clients.run(client -> client.getTables(database, \"*\", TableType.VIRTUAL_VIEW));\n\n      // Retrieving the Table objects from HMS in batches to avoid OOM","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L179-L215","documentation":"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.","triggerScenarios":"listTables() call hits HMS via Thrift and receives TException — connection dropped, metastore timeout, Thrift protocol mismatch, or metastore-side error.","commonSituations":"Metastore down or restarting; wrong metastore URI; network/firewall between client and HMS; Thrift version/protocol mismatch (binary vs HTTP); metastore overloaded/timeouts.","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)"],"exampleFix":"// before\nhive.metastore.uris=thrift://metastore:9083 // unreachable\n// after\n// verify: nc -zv metastore 9083; fix URI or start metastore service","handlingStrategy":"retry","validationCode":"// probe connectivity: new Socket(metastoreHost, 9083) before building catalog","typeGuard":null,"tryCatchPattern":"try { catalog.listTables(ns); } catch (RuntimeException e) { /* retry with backoff if transient TException; else fail fast with cause */ }","preventionTips":["Monitor metastore health and thrift URI correctness","Set sensible client timeouts","Keep Thrift protocol settings in sync with HMS"],"tags":["hive","thrift","metastore","network"],"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"}