apache/seatunnel · error · CatalogException

Failed to list tables in database: ${databaseName}

Error message

Failed to list tables in database: ${databaseName}

What it means

Thrown by HiveMetaStoreCatalog.listTables when the Hive Metastore Thrift call getAllTables fails with a TException after the database existence check passed. It indicates an HMS communication/protocol failure, not a missing database (that case throws DatabaseNotExistException separately).

Source

Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java:599

            return getClient().getAllDatabases();
        } catch (TException e) {
            log.warn(
                    "listDatabases failed via getAllDatabases(), check HMS version compatibility: {}",
                    e.getMessage());
            throw new CatalogException("Failed to list databases", e);
        }
    }

    @Override
    public List<String> listTables(String databaseName)
            throws CatalogException, DatabaseNotExistException {
        try {
            if (!databaseExists(databaseName)) {
                throw new DatabaseNotExistException("hive", databaseName);
            }
            return getClient().getAllTables(databaseName);
        } catch (TException e) {
            throw new CatalogException("Failed to list tables in database: " + databaseName, e);
        }
    }

    @Override
    public boolean tableExists(TablePath tablePath) throws CatalogException {
        return tableExists(tablePath.getDatabaseName(), tablePath.getTableName());
    }

    @Override
    public CatalogTable getTable(TablePath tablePath)
            throws CatalogException, TableNotExistException {
        try {
            if (!tableExists(tablePath.getDatabaseName(), tablePath.getTableName())) {
                throw new TableNotExistException("hive", tablePath);
            }
            Table hiveTable = getTable(tablePath.getDatabaseName(), tablePath.getTableName());
            return convertHiveTableToCatalogTable(hiveTable);
        } catch (TableNotExistException e) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the TException cause for timeouts/connection errors and retry with backoff.
  2. Increase hive.metastore.client.socket.timeout if timeouts occur under load.
  3. Confirm HMS service health and network connectivity to the thrift port.
  4. Check HMS server logs for the failing request.
Defensive patterns

Strategy: retry

Try / catch

try {
    return catalog.listTables(db);
} catch (CatalogException e) {
    if (e.getCause() instanceof org.apache.thrift.TException
        && isTransient(e.getCause())) {
        // retry with exponential backoff
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling listTables(databaseName) when HMS is unreachable mid-call, the thrift call times out, or the metastore server throws an internal error for this database.

Common situations: Transient metastore outage or network partition; socket timeout under load; HMS GC pauses; permission issues on HMS for that database in secured clusters.

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/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/e3e3309b20e8e55e. Report an issue: GitHub.