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

  1. Ensure the warehouse directory exists (create it manually or let open() create it).
  2. Check read permissions for the job's user on the catalog path.
  3. Verify filesystem health (HDFS NameNode, S3 endpoint) and retry.
  4. Ensure catalog.open() was called before listing databases.
  5. 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

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/2f16daec51c1c6f3. Report an issue: GitHub.