apache/seatunnel · error · CatalogException
Listing database exception.
Error message
Listing database exception.
What it means
HudiCatalog.listDatabases enumerates subdirectories of the table parent path on the filesystem. If fs.listStatus throws an IOException (directory missing, permissions, filesystem outage), it is wrapped in this CatalogException.
Source
Thrown at seatunnel-connectors-v2/connector-hudi/src/main/java/org/apache/seatunnel/connectors/seatunnel/hudi/catalog/HudiCatalog.java:140
@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);
}
}
@Override
public List<String> listTables(String databaseName)
throws CatalogException, DatabaseNotExistException {
if (!databaseExists(databaseName)) {
throw new DatabaseNotExistException(catalogName, databaseName);
}
Path dbPath = new Path(tableParentDfsPath, databaseName);
try {
return Arrays.stream(fs.listStatus(dbPath))
.filter(FileStatus::isDirectory)
.map(fileStatus -> fileStatus.getPath().getName())
.collect(Collectors.toList());
} catch (IOException e) {
throw new CatalogException(View on GitHub (pinned to cf67b549a7)
Solutions
- Ensure the warehouse directory exists (create it manually or let open() create it).
- Check read permissions for the job's user on the catalog path.
- Verify filesystem health (HDFS NameNode, S3 endpoint) and retry.
- Ensure catalog.open() was called before listing databases.
- Check the wrapped IOException cause for the specific filesystem error.
Example fix
// before List<String> dbs = catalog.listDatabases(); // open() never called // after catalog.open(); List<String> dbs = catalog.listDatabases();
Defensive patterns
Strategy: try-catch
Validate before calling
org.apache.hadoop.fs.Path root = new org.apache.hadoop.fs.Path(warehouseUri);
org.apache.hadoop.fs.FileSystem fs = root.getFileSystem(new org.apache.hadoop.conf.Configuration());
if (!fs.exists(root)) {
fs.mkdirs(root); // create catalog path before listing
} Try / catch
try {
List<String> dbs = catalog.listDatabases();
} catch (CatalogException e) {
Throwable root = e;
while (root.getCause() != null) root = root.getCause();
throw new RuntimeException("Cannot list databases, root cause: " + root.getMessage(), e);
} Prevention
- Always call catalog.open() before listDatabases().
- Grant the job's user read access to the warehouse directory.
- Retry transient filesystem errors (HDFS/S3) with bounded backoff.
When it happens
Trigger: Calling listDatabases(), or databaseExists()/listTables() which call it, when the tableParentDfsPath cannot be listed: path deleted concurrently, missing read permission, HDFS/object-store errors, or the catalog path was never created because open() did not run.
Common situations: Warehouse directory removed by another job or admin; worker lacks HDFS or S3 read permission; transient NameNode/S3 outage; using a catalog without calling open() first.
Related errors
- Checking catalog path %s exists exception.
- Listing table in database %s exception.
- Error while checking whether table exists under path:${baseP
- Failed to create table %s
- Dropping database %s exception.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/2f16daec51c1c6f3.
Report an issue: GitHub.