apache/seatunnel · error · CatalogException
Database name is null or empty.
Error message
Database name is null or empty.
What it means
HudiCatalog.databaseExists treats a null or empty database name as a programming/config error rather than a false result, throwing CatalogException. The catalog identifies databases as subdirectories under the table parent path, so a valid non-empty name is required to check existence.
Source
Thrown at seatunnel-connectors-v2/connector-hudi/src/main/java/org/apache/seatunnel/connectors/seatunnel/hudi/catalog/HudiCatalog.java:126
} catch (Exception e) {
log.info("Hudi catalog close error.", e);
}
}
@Override
public String name() {
return catalogName;
}
@Override
public String getDefaultDatabase() throws CatalogException {
return "default";
}
@Override
public boolean databaseExists(String databaseName) throws CatalogException {
if (StringUtils.isEmpty(databaseName)) {
throw new CatalogException("Database name is null or empty.");
}
return listDatabases().contains(databaseName);
}
@Override
public List<String> listDatabases() throws CatalogException {
try {
FileStatus[] fileStatuses = fs.listStatus(tableParentDfsPath);
return Arrays.stream(fileStatuses)
.filter(FileStatus::isDirectory)
.map(fileStatus -> fileStatus.getPath().getName())
.collect(Collectors.toList());
} catch (IOException e) {
throw new CatalogException("Listing database exception.", e);
}
}
@OverrideView on GitHub (pinned to cf67b549a7)
Solutions
- Always specify an explicit database name in the table path, e.g. schema.table instead of just table.
- Set the catalog's default database if you intend to rely on it, ensuring it is non-empty.
- Fix caller code that constructs TablePath to fill in the database field.
- Validate the database name is non-blank before invoking catalog APIs.
Example fix
// before
TablePath.of("", "my_table")
// after
TablePath.of("my_db", "my_table") Defensive patterns
Strategy: validation
Validate before calling
if (databaseName == null || databaseName.trim().isEmpty()) {
throw new IllegalArgumentException("database name must be a non-empty string");
} Try / catch
try {
boolean exists = catalog.databaseExists(db);
} catch (CatalogException e) {
throw new IllegalArgumentException("Provide a non-empty database name: " + e.getMessage(), e);
} Prevention
- Always build TablePath with both database and table (schema.table).
- Check for empty database fields when parsing user-supplied table identifiers.
- Rely on the catalog default database only after confirming it is configured.
When it happens
Trigger: Calling databaseExists(null) or databaseExists("") directly, or indirectly via listTables/createDatabase/dropDatabase with an empty database portion of the TablePath, or via open() with a blank default database.
Common situations: TablePath built without a database component (only table name); config option for database left empty; user code passing empty string assuming defaults are applied.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Listing database exception.
- Database ${databaseName} does not exist in catalog ${catalog
- Table ${tablePath} does not exist in catalog ${catalogName}
- Hudi catalog not support truncate table.
- Database ${databaseName} already exists in catalog ${catalog
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/90cb897ba6504be5.
Report an issue: GitHub.