{"record":{"id":"2f16daec51c1c6f3","repo":"apache/seatunnel","slug":"listing-database-exception","errorCode":null,"errorMessage":"Listing database exception.","messagePattern":"Listing database exception\\.","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hudi/src/main/java/org/apache/seatunnel/connectors/seatunnel/hudi/catalog/HudiCatalog.java","lineNumber":140,"sourceCode":"\n    @Override\n    public boolean databaseExists(String databaseName) throws CatalogException {\n        if (StringUtils.isEmpty(databaseName)) {\n            throw new CatalogException(\"Database name is null or empty.\");\n        }\n        return listDatabases().contains(databaseName);\n    }\n\n    @Override\n    public List<String> listDatabases() throws CatalogException {\n        try {\n            FileStatus[] fileStatuses = fs.listStatus(tableParentDfsPath);\n            return Arrays.stream(fileStatuses)\n                    .filter(FileStatus::isDirectory)\n                    .map(fileStatus -> fileStatus.getPath().getName())\n                    .collect(Collectors.toList());\n        } catch (IOException e) {\n            throw new CatalogException(\"Listing database exception.\", e);\n        }\n    }\n\n    @Override\n    public List<String> listTables(String databaseName)\n            throws CatalogException, DatabaseNotExistException {\n        if (!databaseExists(databaseName)) {\n            throw new DatabaseNotExistException(catalogName, databaseName);\n        }\n\n        Path dbPath = new Path(tableParentDfsPath, databaseName);\n        try {\n            return Arrays.stream(fs.listStatus(dbPath))\n                    .filter(FileStatus::isDirectory)\n                    .map(fileStatus -> fileStatus.getPath().getName())\n                    .collect(Collectors.toList());\n        } catch (IOException e) {\n            throw new CatalogException(","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hudi/src/main/java/org/apache/seatunnel/connectors/seatunnel/hudi/catalog/HudiCatalog.java#L122-L158","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nList<String> dbs = catalog.listDatabases(); // open() never called\n// after\ncatalog.open();\nList<String> dbs = catalog.listDatabases();","handlingStrategy":"try-catch","validationCode":"org.apache.hadoop.fs.Path root = new org.apache.hadoop.fs.Path(warehouseUri);\norg.apache.hadoop.fs.FileSystem fs = root.getFileSystem(new org.apache.hadoop.conf.Configuration());\nif (!fs.exists(root)) {\n    fs.mkdirs(root); // create catalog path before listing\n}","typeGuard":null,"tryCatchPattern":"try {\n    List<String> dbs = catalog.listDatabases();\n} catch (CatalogException e) {\n    Throwable root = e;\n    while (root.getCause() != null) root = root.getCause();\n    throw new RuntimeException(\"Cannot list databases, root cause: \" + root.getMessage(), e);\n}","preventionTips":["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."],"tags":["filesystem","io","catalog","hudi"],"backgroundTag":"directory-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}