apache/seatunnel · error · CatalogException

Failed to create table: ${tablePath}

Error message

Failed to create table: ${tablePath}

What it means

createTable() wraps any HiveConnectorException from the internal createTableIfNotExists()/convertCatalogTableToHiveTable() path into a CatalogException. The DDL reached Hive metadata logic but the table could not be created or converted.

Source

Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java:644

            throws TableAlreadyExistException, DatabaseNotExistException, CatalogException {
        try {
            if (!databaseExists(tablePath.getDatabaseName())) {
                throw new DatabaseNotExistException("hive", tablePath.getDatabaseName());
            }

            if (tableExists(tablePath.getDatabaseName(), tablePath.getTableName())) {
                if (!ignoreIfExists) {
                    throw new TableAlreadyExistException("hive", tablePath);
                }
                return;
            }

            Table hiveTable = convertCatalogTableToHiveTable(tablePath, table);
            createTableIfNotExists(hiveTable);
        } catch (TableAlreadyExistException | DatabaseNotExistException | CatalogException e) {
            throw e;
        } catch (HiveConnectorException e) {
            throw new CatalogException("Failed to create table: " + tablePath, e);
        } catch (TException e) {
            throw new CatalogException("Failed to create table: " + tablePath, e);
        }
    }

    @Override
    public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)
            throws TableNotExistException, CatalogException {
        if (!tableExists(tablePath) && !ignoreIfNotExists) {
            throw new TableNotExistException("hive", tablePath);
        }
        if (tableExists(tablePath)) {
            dropTable(tablePath.getDatabaseName(), tablePath.getTableName());
        }
    }

    @Override
    public void createDatabase(TablePath tablePath, boolean ignoreIfExists)

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the HiveConnectorException cause for the exact conversion or metastore rejection reason.
  2. Validate the CatalogTable schema uses Hive-supported types and legal column names.
  3. Check HDFS/warehouse write permissions for the metastore user.
  4. Test the equivalent CREATE TABLE DDL directly in Hive to surface restriction errors.
Defensive patterns

Strategy: try-catch

Validate before calling

// validate schema types are Hive-compatible before create
for (CatalogTable.Column c : table.getTableSchema().getColumns()) {
    // assert SeaTunnelType -> Hive type mapping exists
}

Try / catch

try {
    catalog.createTable(tablePath, table, ignoreIfExists);
} catch (CatalogException e) {
    Throwable cause = e.getCause();
    // log schema + cause; check for conversion/permission errors
}

Prevention

When it happens

Trigger: Calling createTable(tablePath, table, ignoreIfExists) when the internal createTableIfNotExists(hiveTable) throws HiveConnectorException — e.g., conversion failure of CatalogTable to Hive Table, invalid schema/partition keys, or metastore rejection.

Common situations: Unsupported SeaTunnel data types for Hive mapping; schema mismatch (e.g., missing fields); Hive restrictions on table/column names; metastore permission denied on the warehouse directory.

Related errors


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