{"record":{"id":"2f157c783e44f5dc","repo":"apache/seatunnel","slug":"database-databasename-does-not-exist-in-catalog","errorCode":null,"errorMessage":"Database ${databaseName} does not exist in catalog hive","messagePattern":"Database (.+?) does not exist in catalog hive","errorType":"exception","errorClass":"DatabaseNotExistException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java","lineNumber":595,"sourceCode":"\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 {\n        return tableExists(tablePath.getDatabaseName(), tablePath.getTableName());\n    }\n\n    @Override\n    public CatalogTable getTable(TablePath tablePath)\n            throws CatalogException, TableNotExistException {\n        try {\n            if (!tableExists(tablePath.getDatabaseName(), tablePath.getTableName())) {\n                throw new TableNotExistException(\"hive\", tablePath);","sourceCodeStart":577,"sourceCodeEnd":613,"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#L577-L613","documentation":"Thrown by listTables() as a DatabaseNotExistException when databaseExists(databaseName) returns false before querying getAllTables(). It means the named database is absent from the Hive Metastore the catalog is connected to.","triggerScenarios":"Calling listTables(databaseName) (or any flow that enumerates tables) with a database name that does not exist in HMS — typically a typo, wrong case, or a database that lives in a different metastore environment.","commonSituations":"Typo or case mismatch (Hive database names are usually lowercase); pointing the connector at a dev/test metastore while expecting prod databases; database was dropped between plan and execution.","solutions":["List existing databases via listDatabases() or `SHOW DATABASES` in Hive and use an exact existing name.","Check that hive-conf-dir/metastore URI points to the cluster where the database actually exists.","Create the database (CREATE DATABASE) if it is genuinely missing."],"exampleFix":"// before\nList<String> tables = catalog.listTables(\"Prod_Sales\");\n// after: use exact lowercase name verified via listDatabases\nList<String> dbs = catalog.listDatabases();\nif (dbs.contains(\"prod_sales\")) {\n    List<String> tables = catalog.listTables(\"prod_sales\");\n}","handlingStrategy":"validation","validationCode":"if (!catalog.databaseExists(databaseName)) {\n    throw new IllegalArgumentException(\"Database not found: \" + databaseName);\n}\nList<String> tables = catalog.listTables(databaseName);","typeGuard":null,"tryCatchPattern":"try {\n    return catalog.listTables(db);\n} catch (DatabaseNotExistException e) {\n    return List.of(); // or surface a friendly message\n}","preventionTips":["Validate database names against catalog.listDatabases() before use.","Hive db names are typically lowercase — normalize input.","Confirm which metastore environment you are connected to."],"tags":["hive","catalog","database-not-exist","metastore"],"backgroundTag":"entity-not-found","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"}