apache/seatunnel · error · DatabaseNotExistException

Database ${databaseName} does not exist in catalog ${catalog

Error message

Database ${databaseName} does not exist in catalog ${catalogName}

What it means

HudiCatalog.listTables first verifies the requested database exists (as a subdirectory under the catalog path). If databaseExists returns false, it throws DatabaseNotExistException naming the catalog and database. This is SeaTunnel's standard signal that the namespace portion of a table path does not exist.

Source

Thrown at seatunnel-connectors-v2/connector-hudi/src/main/java/org/apache/seatunnel/connectors/seatunnel/hudi/catalog/HudiCatalog.java:148

    @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(
                    String.format("Listing table in database %s exception.", dbPath), e);
        }
    }

    @Override
    public boolean tableExists(TablePath tablePath) throws CatalogException {
        String basePath = inferTablePath(tableParentDfsPathStr, tablePath);
        try {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the database directory exists under the configured warehouse path (hdfs dfs -ls <warehouse>).
  2. Correct the database name spelling/case in the table path configuration.
  3. Create the database first via catalog.createDatabase or manually create the directory.
  4. Ensure the catalog warehouse path points to the filesystem location that actually contains the database.
  5. Run listDatabases() to see the names that do exist and match against them.

Example fix

// before
catalog.listTables("MyDB"); // directory is 'mydb'
// after
catalog.listTables("mydb");
Defensive patterns

Strategy: try-catch

Validate before calling

if (!catalog.databaseExists(databaseName)) {
    // fail fast or create the database before calling listTables
    catalog.createDatabase(databaseName, false);
}

Try / catch

try {
    List<String> tables = catalog.listTables(databaseName);
} catch (DatabaseNotExistException e) {
    // e.getDatabase() tells you the missing namespace
    throw new IllegalStateException("Database '" + databaseName + "' not found in catalog; existing: " + catalog.listDatabases(), e);
}

Prevention

When it happens

Trigger: Calling listTables(databaseName) where no directory named databaseName exists under tableParentDfsPath — database never created, name misspelled, wrong warehouse path configured, or different case than on disk.

Common situations: Typo in database name in the table config; database dropped by another process; pointing the catalog at a different warehouse than the one containing the database; case sensitivity mismatch on a case-sensitive filesystem.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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