apache/seatunnel · error · TableNotExistException

table not exist

Error message

table not exist

What it means

isExistsData checks whether an Iceberg table contains any records by reading the current snapshot's 'total-records' summary. As a precondition it requires the table to exist; if tableExists(tablePath) is false it throws TableNotExistException with message 'table not exist'.

Source

Thrown at seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java:213

        log.info("Dropped table at path: {}", tablePath);
    }

    @Override
    public void createDatabase(TablePath tablePath, boolean ignoreIfExists)
            throws DatabaseAlreadyExistException, CatalogException {
        // Do nothing
    }

    @Override
    public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)
            throws DatabaseNotExistException, CatalogException {
        // Do nothing
    }

    @Override
    public boolean isExistsData(TablePath tablePath) {
        if (!tableExists(tablePath)) {
            throw new TableNotExistException("table not exist", tablePath);
        }
        TableIdentifier icebergTableIdentifier = toIcebergTableIdentifier(tablePath);
        Snapshot snapshot = catalog.loadTable(icebergTableIdentifier).currentSnapshot();
        if (snapshot != null) {
            String total = snapshot.summary().getOrDefault("total-records", null);
            return total != null && !total.equals("0");
        }
        return false;
    }

    @Override
    public void executeSql(TablePath tablePath, String sql) {
        Delete delete;
        try {
            Statement statement = CCJSqlParserUtil.parse(sql);
            delete = (Delete) statement;
        } catch (Throwable e) {
            throw new IllegalArgumentException(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the table exists at the given tablePath in the configured catalog before calling isExistsData
  2. Correct the tablePath namespace/table spelling and environment (warehouse/URI) configuration
  3. Create the table (or skip the data-existence check) when the table is legitimately absent

Example fix

// before checking data of a not-yet-created table
if (catalog.isExistsData(TablePath.of("db", "metrics"))) { ... }
// after
if (catalog.tableExists(TablePath.of("db", "metrics")) && catalog.isExistsData(TablePath.of("db", "metrics"))) { ... }
Defensive patterns

Strategy: validation

Validate before calling

if (!seaTunnelCatalog.tableExists(tablePath)) {
  // skip isExistsData or create the table first
} else {
  boolean hasData = seaTunnelCatalog.isExistsData(tablePath);
}

Try / catch

try {
  boolean hasData = seaTunnelCatalog.isExistsData(tablePath);
} catch (TableNotExistException e) {
  // treat as empty/new: create table or fall back to full load
}

Prevention

When it happens

Trigger: isExistsData(tablePath) is called (e.g. by sync/consistency tooling to decide incremental vs full load) with a table path that does not exist in the configured catalog.

Common situations: Pointing the check at a table in the wrong namespace/warehouse; table dropped before the sync job runs; namespace/table name typos; catalog configured against a different environment than expected.

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/3577ac20cfd30582. Report an issue: GitHub.