{"record":{"id":"6f5d6daefb04e46c","repo":"apache/seatunnel","slug":"listing-table-in-database-s-exception","errorCode":null,"errorMessage":"Listing table in database %s exception.","messagePattern":"Listing table in 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":158,"sourceCode":"            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(\n                    String.format(\"Listing table in database %s exception.\", dbPath), e);\n        }\n    }\n\n    @Override\n    public boolean tableExists(TablePath tablePath) throws CatalogException {\n        String basePath = inferTablePath(tableParentDfsPathStr, tablePath);\n        try {\n            return fs.exists(new Path(basePath, HoodieTableMetaClient.METAFOLDER_NAME))\n                    && fs.exists(\n                            new Path(\n                                    new Path(basePath, HoodieTableMetaClient.METAFOLDER_NAME),\n                                    HoodieTableConfig.HOODIE_PROPERTIES_FILE));\n        } catch (IOException e) {\n            throw new CatalogException(\n                    \"Error while checking whether table exists under path:\" + basePath, e);\n        }\n    }","sourceCodeStart":140,"sourceCodeEnd":176,"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#L140-L176","documentation":"HudiCatalog.listTables() wraps any IOException raised while listing directories under the database path on the Hadoop filesystem. The catalog treats each subdirectory of the database directory as a table, so a failure to read the directory listing aborts table discovery. The IOException is rethrown as a CatalogException with the database path in the message.","triggerScenarios":"Calling listTables(databaseName) (directly or via catalog.tables()) when the underlying distributed filesystem (HDFS/S3/OSS) throws IOException on fs.listStatus(dbPath): NameNode unreachable, S3 throttling/credentials failure, or dbPath missing on the filesystem.","commonSituations":"HDFS NameNode in safemode or down; cloud storage credentials expired; database directory deleted manually or never created because createDatabase was skipped; wrong table parent DFS path configured (table_parent_dfs_path).","solutions":["Verify the database directory exists on the configured filesystem (hdfs dfs -ls / hadoop fs -ls on table_parent_dfs_path/<db>) and create it if missing.","Check filesystem connectivity and credentials (core-site.xml/hdfs-site.xml on classpath, cloud storage access keys, endpoint).","Retry once transient errors (NameNode safemode, S3 throttling) are resolved.","Confirm the catalog's table_parent_dfs_path option points to the root that actually contains your databases."],"exampleFix":"// before\nList<String> tables = catalog.listTables(\"mydb\");\n// after\nif (!catalog.databaseExists(\"mydb\")) {\n    catalog.createDatabase(TablePath.of(\"mydb\", \"t\"), true);\n}\nList<String> tables = catalog.listTables(\"mydb\");","handlingStrategy":"try-catch","validationCode":"// Java\nif (!catalog.databaseExists(dbName)) {\n    catalog.createDatabase(TablePath.of(dbName, \"t\"), true);\n}\nFileSystem fs = FileSystem.get(conf);\nif (!fs.exists(dbPath)) { /* create or abort */ }","typeGuard":null,"tryCatchPattern":"// Java\ntry {\n    tables = catalog.listTables(dbName);\n} catch (CatalogException e) {\n    if (e.getCause() instanceof IOException) {\n        // check storage health, then retry\n    } else throw e;\n}","preventionTips":["Ensure the database directory exists before listing tables.","Keep Hadoop/cloud storage configs and credentials on the classpath and valid.","Monitor storage availability (NameNode health, S3 status) before pipeline runs.","Pin table_parent_dfs_path consistently across all jobs."],"tags":["hadoop","filesystem","io","catalog"],"backgroundTag":"file-read-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}