apache/seatunnel · error · TableNotExistException
TABLE_NOT_EXISTED
TABLE_NOT_EXISTED
Error message
Table %s does not exist in Catalog %s.
What it means
TableNotExistException (code TABLE_NOT_EXISTED) is thrown by truncateTable when tableExists() reports the table missing and ignoreIfNotExists is false. The catalog refuses to run TRUNCATE on a non-existent table.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java:596
String dbUrl = getUrlFromDatabaseName(databaseName);
try {
Connection connection = connectionMap.remove(dbUrl);
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
throw new CatalogException(String.format("Failed to close %s via JDBC.", dbUrl), e);
}
}
public void truncateTable(TablePath tablePath, boolean ignoreIfNotExists)
throws TableNotExistException, CatalogException {
checkNotNull(tablePath, "Table path cannot be null");
if (!tableExists(tablePath)) {
if (ignoreIfNotExists) {
return;
}
throw new TableNotExistException(catalogName, tablePath);
}
truncateTableInternal(tablePath);
}
@Override
public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)
throws DatabaseNotExistException, CatalogException {
checkNotNull(tablePath, "Table path cannot be null");
checkNotNull(tablePath.getDatabaseName(), "Database name cannot be null");
if (!databaseExists(tablePath.getDatabaseName())) {
if (ignoreIfNotExists) {
return;
}
throw new DatabaseNotExistException(catalogName, tablePath.getDatabaseName());
}
dropDatabaseInternal(tablePath.getDatabaseName());
}View on GitHub (pinned to cf67b549a7)
Solutions
- Verify the table exists: catalog.tableExists(tablePath).
- Pass ignoreIfNotExists=true if truncation is optional.
- Correct the TablePath database/table names (check case sensitivity).
- Confirm you are connected to the intended catalog/database environment.
Example fix
// before
catalog.truncateTable(TablePath.of("db", "TBL"), false);
// after
TablePath path = TablePath.of("db", "tbl"); // correct case
if (catalog.tableExists(path)) {
catalog.truncateTable(path, false);
} Defensive patterns
Strategy: validation
Validate before calling
if (!catalog.tableExists(tablePath)) { if (!ignore) throw ...; return; } Try / catch
try { catalog.truncateTable(path, false); } catch (TableNotExistException e) { LOG.warn("Table {} not found in {}; skipping truncate", path.getFullName(), catalogName); } Prevention
- Verify tableExists before truncating
- Use ignoreIfNotExists=true for optional truncation
- Check identifier case sensitivity
- Confirm the correct catalog/database environment
When it happens
Trigger: Calling catalog.truncateTable(tablePath, false) for a table path that does not exist in the catalog (wrong database/table name, wrong catalog, or table dropped concurrently).
Common situations: Typo in table or database name; job configured for a different catalog/database than expected; table dropped by another process between check and truncate; case-sensitivity mismatch in identifiers.
Related errors
- Failed truncate table %s in catalog %s
- TABLE_NOT_EXISTED
- Can not find catalog table with factoryId [%s]
- Failed to truncate BigQuery table:
- Truncate table failed
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/9305032bba442e26.
Report an issue: GitHub.