apache/seatunnel · error

listDatabases failed via getAllDatabases(), check HMS versio

Error message

listDatabases failed via getAllDatabases(), check HMS version compatibility: {}

What it means

HiveMetaStoreCatalog.listDatabases calls IMetaStoreClient.getAllDatabases(); when the Thrift call fails with a TException, it logs this warning (suggesting an HMS version incompatibility as a possible cause) and wraps the exception in a CatalogException('Failed to list databases'). The warning message is a diagnostic hint; the actual failure surfaces as a CatalogException to the caller (e.g. catalog open or database discovery).

Source

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

        }
    }

    @Override
    public String name() {
        return "hive";
    }

    @Override
    public String getDefaultDatabase() throws CatalogException {
        return "default";
    }

    @Override
    public List<String> listDatabases() throws CatalogException {
        try {
            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);
        }
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify HMS connectivity from the job node: nc/teleport to the metastore host:9083 and confirm the service is running.
  2. Align Hive client and HMS server versions: check the hive-exec/hive-metastore versions on the classpath and match the metastore's Thrift protocol (set hive.metastore.client.socket.timeout / use the matching client).
  3. Check hive-site.xml on the job classpath points to the correct metastore URIs and, if Kerberized, that the principal/realm and keytab are correct.
  4. Inspect the underlying TException stack trace in the thrown CatalogException to distinguish connectivity from RPC/version errors.

Example fix

// before (blind retry hides the real cause)
List<String> dbs = catalog.listDatabases();

// after (validate connectivity first)
try {
    List<String> dbs = catalog.listDatabases();
} catch (CatalogException e) {
    LOG.error("HMS unreachable or incompatible: {}", e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
    throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Before job start, verify HMS reachability:
try (Socket s = new Socket()) {
    s.connect(new InetSocketAddress(hmsHost, hmsPort), 3000); // e.g. port 9083
} catch (IOException e) {
    throw new IllegalStateException("HMS unreachable: " + hmsHost + ":" + hmsPort, e);
}

Try / catch

try {
    List<String> dbs = catalog.listDatabases();
} catch (CatalogException e) {
    Throwable cause = e.getCause(); // TException root cause
    LOG.error("listDatabases failed; check HMS version/connectivity: {}", cause, cause);
    // fall back to statically configured database name or abort job startup
}

Prevention

When it happens

Trigger: Calling listDatabases() (directly or via catalog operations that enumerate databases) when the HMS Thrift connection fails, the metastore rejects the getAllDatabases call, Kerberos/Hive config is wrong, or the HMS server version does not support the API as invoked by the client library.

Common situations: SeaTunnel built against Hive 2.x client talking to an HMS 1.x/3.x server with mismatched Thrift protocols; HMS host/port unreachable (fs.defaultFS/metastore URIs misconfigured in hive-site.xml); Kerberos authentication failing so the RPC is rejected; firewall or DNS blocking the metastore port (9083).

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/d72fbf0b9f087a1d. Report an issue: GitHub.