{"record":{"id":"6d49dca677cb27ae","repo":"apache/seatunnel","slug":"failed-to-list-databases","errorCode":null,"errorMessage":"Failed to list databases","messagePattern":"Failed to list databases","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java","lineNumber":586,"sourceCode":"    @Override\n    public String name() {\n        return \"hive\";\n    }\n\n    @Override\n    public String getDefaultDatabase() throws CatalogException {\n        return \"default\";\n    }\n\n    @Override\n    public List<String> listDatabases() throws CatalogException {\n        try {\n            return getClient().getAllDatabases();\n        } catch (TException e) {\n            log.warn(\n                    \"listDatabases failed via getAllDatabases(), check HMS version compatibility: {}\",\n                    e.getMessage());\n            throw new CatalogException(\"Failed to list databases\", e);\n        }\n    }\n\n    @Override\n    public List<String> listTables(String databaseName)\n            throws CatalogException, DatabaseNotExistException {\n        try {\n            if (!databaseExists(databaseName)) {\n                throw new DatabaseNotExistException(\"hive\", databaseName);\n            }\n            return getClient().getAllTables(databaseName);\n        } catch (TException e) {\n            throw new CatalogException(\"Failed to list tables in database: \" + databaseName, e);\n        }\n    }\n\n    @Override\n    public boolean tableExists(TablePath tablePath) throws CatalogException {","sourceCodeStart":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java#L568-L604","documentation":"HiveMetaStoreCatalog.listDatabases() wraps any TException thrown by the Hive Metastore client's getAllDatabases() call into a CatalogException. This is a thin passthrough: the metastore RPC itself failed (connectivity, thrift protocol, or HMS server error). The warn log about HMS version compatibility hints the call signature may differ across Hive versions.","triggerScenarios":"Calling listDatabases() when the Hive Metastore is unreachable, the thrift client fails to serialize/deserialize the request, or the HMS server rejects the getAllDatabases() RPC (e.g., incompatible Hive metastore version).","commonSituations":"Wrong hive-site.xml or metastore URIs in classpath; HMS service down or firewall blocking the thrift port (default 9083); Kerberos/ldap auth misconfiguration; connecting a newer client to an older HMS whose Thrift protocol version differs.","solutions":["Verify the HMS thrift URI and port are correct and reachable (telnet/nc to the metastore host:9083).","Check that hive-site.xml on the classpath points to the right metastore and matches the cluster's Hive version.","Set hive.metastore.client.socket.timeout and align hive.metastore.thrift.protocol/version if versions differ.","Inspect the root cause (cause of the CatalogException) for auth errors (Kerberos/ldap) and fix credentials/keytabs."],"exampleFix":"// before: relying on default auto-discovered hive-site\nCatalog catalog = new HiveMetaStoreCatalog(\"default_hive_catalog\", Map.of());\n// after: supply explicit metastore URI and hive-conf-dir\nMap<String, Serializable> props = new HashMap<>();\nprops.put(\"hive-conf-dir\", \"/etc/hive/conf\");\nprops.put(\"uri\", \"thrift://metastore-host:9083\");","handlingStrategy":"try-catch","validationCode":"// before calling\nboolean reachable = true;\ntry (java.net.Socket s = new java.net.Socket(\"metastore-host\", 9083)) { }\ncatch (java.io.IOException e) { reachable = false; }","typeGuard":null,"tryCatchPattern":"try {\n    List<String> dbs = catalog.listDatabases();\n} catch (CatalogException e) {\n    Throwable root = e.getCause();\n    // check root for TTransportException/timeout and retry or fail fast\n}","preventionTips":["Pin hive-site.xml with correct metastore URIs on the classpath.","Health-check the HMS thrift port before job submission.","Align Hive client and server versions / thrift protocol versions."],"tags":["hive","metastore","catalog","thrift","connectivity"],"backgroundTag":"api-request-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}