apache/seatunnel · error · HbaseConnectorException

TABLE_EXISTS_EXCEPTION

TABLE_EXISTS_EXCEPTION

Error message

HbaseConnectorErrorCode.TABLE_EXISTS_EXCEPTION.getErrorMessage()

What it means

In createTable(), if the target HBase table already exists and ignoreIfExists is false, HbaseConnectorException with TABLE_EXISTS_EXCEPTION is thrown (without a cause). This protects existing tables from being silently recreated or overwritten.

Solutions

  1. Set the ignore-exists / ignore-if-exists config option to true to skip existing tables
  2. Drop the existing table first (e.g. via catalog.dropTable) if recreation is intended
  3. Use a different table name if the existing data must be preserved
  4. Check with tableExists() before calling createTable

Example fix

// before
hbaseClient.createTable(databaseName, tableName, families, false);
// after
hbaseClient.createTable(databaseName, tableName, families, true); // or drop/verify beforehand
Defensive patterns

Strategy: validation

Validate before calling

if (client.tableExists(TableName.valueOf(ns, table).getNameAsString()) && !ignoreIfExists) {
    throw new IllegalStateException("Table " + ns + ":" + table + " exists and ignoreIfExists=false");
}

Try / catch

try {
    client.createTable(ns, table, families, ignoreIfExists);
} catch (HbaseConnectorException e) {
    if (e.getErrorCode() == HbaseConnectorErrorCode.TABLE_EXISTS_EXCEPTION) {
        log.info("Table already exists; skipping creation");
    } else throw e;
}

Prevention

When it happens

Trigger: Calling createTable() (or a schema-save catalog path) where TableName.valueOf(databaseName, tableName) already exists in HBase and ignoreIfExists=false.

Common situations: Re-running a job with auto-create enabled against an existing table without the ignore-exists flag; a previous failed run already created the table; table name collision between jobs.

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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/client/HbaseClient.java:215

     * @param databaseName database name
     * @param tableName table name
     * @param columnFamilies column families
     * @param ignoreIfExists ignore if the table already exists
     */
    public void createTable(
            String databaseName,
            String tableName,
            List<String> columnFamilies,
            boolean ignoreIfExists) {
        try {
            if (!databaseExists(databaseName) && !StringUtils.isBlank(databaseName)) {
                admin.createNamespace(NamespaceDescriptor.create(databaseName).build());
            }
            TableName table = TableName.valueOf(databaseName, tableName);
            if (tableExists(table.getNameAsString())) {
                log.info("Table {} already exists.", table.getNameAsString());
                if (!ignoreIfExists) {
                    throw new HbaseConnectorException(
                            HbaseConnectorErrorCode.TABLE_EXISTS_EXCEPTION,
                            HbaseConnectorErrorCode.TABLE_EXISTS_EXCEPTION.getErrorMessage());
                }
                return;
            }
            TableDescriptorBuilder hbaseTableDescriptor = TableDescriptorBuilder.newBuilder(table);
            columnFamilies.forEach(
                    family ->
                            hbaseTableDescriptor.setColumnFamily(
                                    ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(family))
                                            .build()));
            admin.createTable(hbaseTableDescriptor.build());
        } catch (IOException e) {
            throw new HbaseConnectorException(
                    HbaseConnectorErrorCode.TABLE_CREATE_EXCEPTION,
                    HbaseConnectorErrorCode.TABLE_CREATE_EXCEPTION.getErrorMessage(),
                    e);
        }

View on GitHub (pinned to cf67b549a7)