apache/seatunnel · error · TableNotExistException

TableNotExistException: catalogName, tablePath

Error message

TableNotExistException: catalogName, tablePath

What it means

DatabendCatalog.getTable(tablePath) calls tableExists(tablePath) first; if the table is absent it throws SeaTunnel's standard TableNotExistException for (catalogName, tablePath). This is the API-declared checked exception meaning the requested table (database + table) does not exist in Databend.

Source

Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/catalog/DatabendCatalog.java:221

                            .getMetaData()
                            .getTables(null, databaseName, tableName, new String[] {"TABLE"})) {
                return resultSet.next();
            }
        } catch (SQLException e) {
            throw new DatabendConnectorException(
                    DatabendConnectorErrorCode.SQL_OPERATION_FAILED,
                    "Failed to check if table exists: " + e.getMessage(),
                    e);
        }
    }

    @Override
    public CatalogTable getTable(TablePath tablePath)
            throws CatalogException, TableNotExistException {
        checkOpen();

        if (!tableExists(tablePath)) {
            throw new TableNotExistException(catalogName, tablePath);
        }

        try (Connection connection = getConnection()) {
            String databaseName = tablePath.getDatabaseName();
            String tableName = tablePath.getTableName();

            // Get table schema
            List<Column> columns = new ArrayList<>();
            try (ResultSet resultSet =
                    connection.getMetaData().getColumns(null, databaseName, tableName, null)) {
                while (resultSet.next()) {
                    String columnName = resultSet.getString("COLUMN_NAME");
                    String typeName = resultSet.getString("TYPE_NAME");
                    int dataType = resultSet.getInt("DATA_TYPE");
                    int columnSize = resultSet.getInt("COLUMN_SIZE");
                    int decimalDigits = resultSet.getInt("DECIMAL_DIGITS");
                    String isNullable = resultSet.getString("IS_NULLABLE");
                    String remarks = resultSet.getString("REMARKS");

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Confirm the exact database and table names on the target Databend instance (SHOW TABLES IN <db>) and correct the TablePath in the job config.
  2. Create the table first (CREATE TABLE or via catalog createTable) before reading its metadata.
  3. Verify the catalog URL/credentials point at the intended environment where the table exists.

Example fix

// before
getTable(TablePath.of("analytics", "user_event")) // table doesn't exist
// after
// CREATE TABLE analytics.user_event (...) first, or fix the name:
getTable(TablePath.of("analytics", "user_events"))
Defensive patterns

Strategy: validation

Validate before calling

// before calling getTable
SHOW TABLES IN mydb; -- confirm the table name exists
if (!catalog.tableExists(TablePath.of("mydb", "mytable"))) {
  throw new IllegalStateException("table missing, create it first");
}

Try / catch

try {
  table = catalog.getTable(tablePath);
} catch (TableNotExistException e) {
  log.warn("table {} missing, creating schema", tablePath);
  catalog.createTable(tablePath, createTableConfig, false);
  table = catalog.getTable(tablePath);
}

Prevention

When it happens

Trigger: Calling getTable (directly or via catalogTable) with a TablePath whose database or table does not exist — table dropped or renamed, wrong schema in the TablePath, or the catalog is connected to a different Databend environment than the one where the table was created.

Common situations: Schema evolution/migration removed the table, dev-vs-prod mismatch, case or name typo in the sink/source table path, table created after the check ran in a race, or pointing at a tenant lacking the table.

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/2fef29b764473df0. Report an issue: GitHub.