apache/seatunnel · error · DatabaseAlreadyExistException
Database already exists in catalog
Error message
Database ${databaseName} already exists in catalog ${catalogName} What it means
Thrown by PaimonCatalog.createDatabase when the underlying Paimon catalog reports that the target database already exists and ignoreIfExists=false. SeaTunnel wraps Paimon's Catalog.DatabaseAlreadyExistException into its own DatabaseAlreadyExistException, carrying the SeaTunnel catalog name and database name.
Solutions
- Pass ignoreIfExists=true if the database existing is acceptable
- Drop the existing database first (dropDatabase) or pick a different databaseName in table_path
- Verify warehouse/metastore state and remove stale database metadata if it is orphaned
- Serialize initialization across concurrent jobs that auto-create the same database
Example fix
// before catalog.createDatabase(tablePath, false); // after catalog.createDatabase(tablePath, true); // or pre-check: if (!catalog.databaseExists(tablePath.getDatabaseName())) ...
Defensive patterns
Strategy: try-catch
Validate before calling
if (!catalog.databaseExists(tablePath.getDatabaseName())) {
catalog.createDatabase(tablePath, false);
} Try / catch
try {
catalog.createDatabase(tablePath, ignoreIfExists);
} catch (DatabaseAlreadyExistException e) {
LOG.warn("database {} already exists, skipping", tablePath.getDatabaseName());
} Prevention
- Prefer ignoreIfExists=true for idempotent job startup
- Pre-check databaseExists before creating
- Avoid multiple jobs auto-creating the same database concurrently
- Use unique database names per environment/pipeline
When it happens
Trigger: Calling createDatabase(tablePath, false) (e.g. auto-create logic during sink setup) when the database already exists in the Paimon warehouse; also occurs when the catalog is backed by a shared metastore (Hive/HDFS) where another job created the same database.
Common situations: Multiple jobs or retries racing to auto-create the same database; running a job twice without cleaning the warehouse path; typo'd or reused databaseName from config; Hive metastore still holding the db after warehouse files were deleted.
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
- Database already exists in catalog hive
- Database does not exist in catalog
- Failed to check database existence
- LOAD_CATALOG
- paimon privilege is enabled, user and password is required
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/fa2bc311e2b5f9fa.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java:209
}
@Override
public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)
throws TableNotExistException, CatalogException {
try {
catalog.dropTable(toIdentifier(tablePath), ignoreIfNotExists);
} catch (org.apache.paimon.catalog.Catalog.TableNotExistException e) {
throw new TableNotExistException(this.catalogName, tablePath);
}
}
@Override
public void createDatabase(TablePath tablePath, boolean ignoreIfExists)
throws DatabaseAlreadyExistException, CatalogException {
try {
catalog.createDatabase(tablePath.getDatabaseName(), ignoreIfExists);
} catch (org.apache.paimon.catalog.Catalog.DatabaseAlreadyExistException e) {
throw new DatabaseAlreadyExistException(this.catalogName, tablePath.getDatabaseName());
}
}
@Override
public void truncateTable(TablePath tablePath, boolean ignoreIfNotExists)
throws TableNotExistException, CatalogException {
try {
Identifier identifier = toIdentifier(tablePath);
FileStoreTable table = (FileStoreTable) catalog.getTable(identifier);
Schema schema = buildPaimonSchema(table.schema());
dropTable(tablePath, ignoreIfNotExists);
catalog.createTable(identifier, schema, ignoreIfNotExists);
} catch (org.apache.paimon.catalog.Catalog.TableNotExistException e) {
throw new TableNotExistException(this.catalogName, tablePath);
} catch (org.apache.paimon.catalog.Catalog.TableAlreadyExistException e) {
throw new DatabaseAlreadyExistException(this.catalogName, tablePath.getDatabaseName());
} catch (org.apache.paimon.catalog.Catalog.DatabaseNotExistException e) {
throw new DatabaseNotExistException(this.catalogName, tablePath.getDatabaseName());View on GitHub (pinned to cf67b549a7)