apache/seatunnel · error · DatabaseNotExistException
DatabaseNotExistException: catalogName, databaseName
Error message
DatabaseNotExistException: catalogName, databaseName
What it means
DatabendCatalog.listTables() first calls databaseExists(databaseName); when that returns false it throws SeaTunnel's standard DatabaseNotExistException for (catalogName, databaseName). This is the API-declared checked exception meaning the requested database/schema does not exist in the Databend catalog.
Source
Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/catalog/DatabendCatalog.java:172
String databaseName = resultSet.getString("TABLE_SCHEM");
databases.add(databaseName);
}
}
return databases;
} catch (SQLException e) {
throw new DatabendConnectorException(
DatabendConnectorErrorCode.SQL_OPERATION_FAILED,
"Failed to list databases: " + e.getMessage(),
e);
}
}
@Override
public List<String> listTables(String databaseName)
throws CatalogException, DatabaseNotExistException {
checkOpen();
if (!databaseExists(databaseName)) {
throw new DatabaseNotExistException(catalogName, databaseName);
}
try (Connection connection = getConnection()) {
DatabaseMetaData metaData = connection.getMetaData();
List<String> tables = new ArrayList<>();
try (ResultSet resultSet =
metaData.getTables(null, databaseName, null, new String[] {"TABLE"})) {
while (resultSet.next()) {
String tableName = resultSet.getString("TABLE_NAME");
tables.add(tableName);
}
}
return tables;
} catch (SQLException e) {
throw new DatabendConnectorException(
DatabendConnectorErrorCode.SQL_OPERATION_FAILED,
"Failed to list tables: " + e.getMessage(),
e);View on GitHub (pinned to cf67b549a7)
Solutions
- Run SHOW DATABASES on the target Databend instance and confirm the exact schema name, then correct databaseName in the job config.
- Create the database first (CREATE DATABASE ...) or have the pipeline create it via createDatabase before listing tables.
- Verify the catalog URL points at the environment you expect (dev vs prod, correct tenant).
Example fix
// before
listTables("my_databse") // typo
// after
listTables("my_database") // matches SHOW DATABASES output Defensive patterns
Strategy: validation
Validate before calling
// before calling listTables
SHOW DATABASES; -- confirm exact schema name, then compare in code
if (!databases.stream().anyMatch(d -> d.equalsIgnoreCase(targetDb))) {
throw new IllegalArgumentException("database not found: " + targetDb);
} Try / catch
try {
tables = catalog.listTables(db);
} catch (DatabaseNotExistException e) {
log.warn("db {} missing, creating it", db);
catalog.createDatabase(db, false);
tables = catalog.listTables(db);
} Prevention
- Copy database names from SHOW DATABASES output rather than typing them
- Create the target database as a pipeline prerequisite step
- Confirm which environment (dev/prod/tenant) the catalog URL points to
- Use consistent naming conventions across job configs
When it happens
Trigger: Calling listTables with a databaseName that does not exist in Databend — misspelled schema name, wrong case (lookups are case-insensitive equalsIgnoreCase but the DB genuinely is absent), or connecting to a different Databend instance/tenant than intended.
Common situations: Config references a database that was dropped, dev-vs-prod environment mismatch, database created in another warehouse/tenant, or name typo in the SeaTunnel job config.
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
- TableNotExistException: catalogName, tablePath
- Failed getting table %s
- LIST_DATABASES_FAILED
- LIST_TABLES_FAILED
- CONNECT_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/242f6d693c458887.
Report an issue: GitHub.