apache/seatunnel · error · TableAlreadyExistException

Table ${tablePath} already exists in catalog ${catalogName}

Error message

Table ${tablePath} already exists in catalog ${catalogName}

What it means

PaimonCatalog.createTable maps Paimon's native Catalog.TableAlreadyExistException to SeaTunnel's TableAlreadyExistException when catalog.createTable finds the identifier already occupied. It signals the create request conflicts with an existing table at the same path.

Source

Thrown at seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java:185

        try {
            return catalog.getTable(toIdentifier(tablePath));
        } catch (org.apache.paimon.catalog.Catalog.TableNotExistException e) {
            throw new TableNotExistException(this.catalogName, tablePath);
        }
    }

    @Override
    public void createTable(TablePath tablePath, CatalogTable table, boolean ignoreIfExists)
            throws TableAlreadyExistException, DatabaseNotExistException, CatalogException {
        try {
            Schema paimonSchema =
                    SchemaUtil.toPaimonSchema(
                            table.getTableSchema(),
                            new PaimonSinkConfig(readonlyConfig),
                            table.getComment());
            catalog.createTable(toIdentifier(tablePath), paimonSchema, ignoreIfExists);
        } catch (org.apache.paimon.catalog.Catalog.TableAlreadyExistException e) {
            throw new TableAlreadyExistException(this.catalogName, tablePath);
        } catch (org.apache.paimon.catalog.Catalog.DatabaseNotExistException e) {
            throw new DatabaseNotExistException(this.catalogName, tablePath.getDatabaseName());
        } catch (Exception e) {
            resolveException(e);
        }
    }

    @Override
    public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)
            throws TableNotExistException, CatalogException {
        try {
            catalog.dropTable(toIdentifier(tablePath), ignoreIfNotExists);
        } catch (org.apache.paimon.catalog.Catalog.TableNotExistException e) {
            throw new TableNotExistException(this.catalogName, tablePath);
        }
    }

    @Override

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Pass ignoreIfExists=true if the table may legitimately pre-exist.
  2. Drop the existing table (or use truncateTable) before recreating.
  3. Use a different table path for the new output.
  4. Coordinate concurrent jobs so only one creates the table, or make creation idempotent.

Example fix

// before
catalog.createTable(path, table, false); // fails if table exists
// after
catalog.createTable(path, table, true); // idempotent create
Defensive patterns

Strategy: try-catch

Validate before calling

if (catalog.tableExists(tablePath)) {
    // already there: skip, drop, or reuse
}

Try / catch

try {
    catalog.createTable(tablePath, table, false);
} catch (TableAlreadyExistException e) {
    LOG.warn("Table {} already exists; skipping create", tablePath);
}

Prevention

When it happens

Trigger: Calling createTable(tablePath, table, ignoreIfExists) where a table already exists at the identifier and ignoreIfExists is false, causing Paimon to raise TableAlreadyExistException.

Common situations: Auto-create logic running against a table created by a previous job, concurrent jobs creating the same table, re-running a pipeline without drop/cleanup, or forgetting ignoreIfExists=true for idempotent creates.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


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