apache/seatunnel · error · DatabaseAlreadyExistException
DatabaseAlreadyExistException: database '${databaseName}' al
Error message
DatabaseAlreadyExistException: database '${databaseName}' already exists in catalog '${catalogName}' What it means
Thrown by HbaseCatalog.createDatabase when the target database (HBase namespace) already exists and ignoreIfExists is false. The catalog checks databaseExists before calling hbaseClient.createNamespace.
Source
Thrown at seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/catalog/HbaseCatalog.java:159
@Override
public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)
throws TableNotExistException, CatalogException {
checkNotNull(tablePath);
if (!tableExists(tablePath)) {
if (!ignoreIfNotExists) {
throw new TableNotExistException(catalogName, tablePath);
}
return;
}
hbaseClient.dropTable(tablePath.getDatabaseName(), tablePath.getTableName());
}
@Override
public void createDatabase(TablePath tablePath, boolean ignoreIfExists)
throws DatabaseAlreadyExistException, CatalogException {
if (databaseExists(tablePath.getDatabaseName())) {
if (!ignoreIfExists) {
throw new DatabaseAlreadyExistException(catalogName, tablePath.getDatabaseName());
}
return;
}
hbaseClient.createNamespace(tablePath.getDatabaseName());
}
@Override
public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)
throws DatabaseNotExistException, CatalogException {
if (!databaseExists(tablePath.getDatabaseName())) {
if (!ignoreIfNotExists) {
throw new DatabaseNotExistException(catalogName, tablePath.getDatabaseName());
}
return;
}
hbaseClient.deleteNamespace(tablePath.getDatabaseName());
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Pass ignoreIfExists = true to make creation idempotent.
- Check existence first with databaseExists before creating.
- Remove duplicate initialization logic or guard it with a flag.
Example fix
// before catalog.createDatabase(path, false); // fails on rerun // after catalog.createDatabase(path, true); // skip if exists
Defensive patterns
Strategy: validation
Validate before calling
if (!catalog.databaseExists(tablePath.getDatabaseName())) {
catalog.createDatabase(tablePath, false);
} else {
catalog.createDatabase(tablePath, true); // no-op
} Try / catch
try {
catalog.createDatabase(tablePath, false);
} catch (DatabaseAlreadyExistException e) {
LOG.info("Namespace {} already exists", tablePath.getDatabaseName());
} Prevention
- Use ignoreIfExists = true in initialization code that runs on every job start.
- Guard namespace creation with databaseExists.
- Avoid creating namespaces in multiple places in the pipeline.
When it happens
Trigger: Calling createDatabase(tablePath, ignoreIfExists=false) for a namespace that already exists in HBase.
Common situations: Initialization code executed on every job start without idempotency; namespace created by HBase admin; concurrent jobs creating the same namespace.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- TableAlreadyExistException: table '${tablePath}' already exi
- Failed to open catalog %s
- DatabaseNotExistException: database '${databaseName}' does n
- Not implement
- TableNotExistException: table '${tablePath}' does not exist
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/1622ea2f18858344.
Report an issue: GitHub.