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 OOM

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Verify Hive metastore is up and reachable at the configured thrift:// URI
  2. Check network/firewall and metastore logs for the underlying TException
  3. Align client Thrift settings (protocol, timeout) with the metastore configuration
  4. 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

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


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/ecef16a89ce12e10. Report an issue: GitHub.