apache/seatunnel · error · CatalogException
Failed to create database: ${databaseName}
Error message
Failed to create database: ${databaseName} What it means
Generic CatalogException thrown by HiveMetaStoreCatalog.createDatabase when the metastore call fails for any reason other than a benign AlreadyExistsException (e.g. connectivity or Thrift errors). It wraps the original TException as the cause.
Source
Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java:670
throws TableNotExistException, CatalogException {
if (!tableExists(tablePath) && !ignoreIfNotExists) {
throw new TableNotExistException("hive", tablePath);
}
if (tableExists(tablePath)) {
dropTable(tablePath.getDatabaseName(), tablePath.getTableName());
}
}
@Override
public void createDatabase(TablePath tablePath, boolean ignoreIfExists)
throws DatabaseAlreadyExistException, CatalogException {
try {
createDatabaseIfNotExists(tablePath.getDatabaseName());
} catch (TException e) {
if (e instanceof AlreadyExistsException && !ignoreIfExists) {
throw new DatabaseAlreadyExistException("hive", tablePath.getDatabaseName());
}
throw new CatalogException(
"Failed to create database: " + tablePath.getDatabaseName(), e);
}
}
@Override
public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)
throws DatabaseNotExistException, CatalogException {
try {
if (!databaseExists(tablePath.getDatabaseName()) && !ignoreIfNotExists) {
throw new DatabaseNotExistException("hive", tablePath.getDatabaseName());
}
if (databaseExists(tablePath.getDatabaseName())) {
getClient().dropDatabase(tablePath.getDatabaseName());
}
} catch (TException e) {
throw new CatalogException(
"Failed to drop database: " + tablePath.getDatabaseName(), e);
}View on GitHub (pinned to cf67b549a7)
Solutions
- Inspect the wrapped cause (getCause()) for the real TException message
- Verify the Hive Metastore URI and that the service is reachable (telnet/nc the thrift port)
- Check kerberos settings (hive-site.xml, keytab/principal) if the cluster is secured
- Retry after fixing connectivity; ensure Hive and SeaTunnel Hive connector versions are compatible
Example fix
// before
try { catalog.createDatabase(tablePath, false); }
catch (Exception e) { log.error("failed", e); }
// after
try { catalog.createDatabase(tablePath, true); }
catch (DatabaseAlreadyExistException e) { /* ok */ }
catch (CatalogException e) { throw new RuntimeException("Metastore call failed: " + e.getCause(), e); } Defensive patterns
Strategy: try-catch
Validate before calling
// preflight: try connecting to metastore hiveConf.addResource(new Path(hiveSitePath)); // then attempt a light call e.g. getAllDatabases()
Type guard
null
Try / catch
try { catalog.createDatabase(tablePath, true); } catch (CatalogException e) { throw new RuntimeException("Metastore failure: " + e.getCause(), e); } Prevention
- Monitor metastore URI reachability before submitting jobs
- Log the wrapped cause, not just the wrapper
- Validate kerberos config early
- Keep Hive metastore and connector Thrift versions compatible
When it happens
Trigger: createDatabase cannot reach the Hive Metastore (network down, wrong metastore URI), the Thrift call throws a non-AlreadyExists TException, or authentication/authorization to the metastore fails.
Common situations: Metastore service is down or unreachable; kerberos/login issues; firewall blocking the metastore thrift port; metastore schema mismatch after a Hive version upgrade.
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
- Failed to open Hive catalog
- Failed to list databases
- Database ${databaseName} does not exist in catalog hive
- Failed to list tables in database: ${databaseName}
- Table ${tablePath} does not exist in catalog hive
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/0ea4c07cbfec11bb.
Report an issue: GitHub.