apache/seatunnel · error · IllegalArgumentException

tableName cannot be empty

Error message

tableName cannot be empty

What it means

The TableIdentifier constructor requires a non-empty tableName. After Lombok @NonNull, it explicitly checks StringUtils.isEmpty(tableName) and throws IllegalArgumentException to guarantee every table identifier names a table. TableIdentifier is the key used to identify tables across catalogs, so an empty name would be invalid.

Source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TableIdentifier.java:48

public final class TableIdentifier implements Serializable {
    private static final long serialVersionUID = 1L;

    private final String catalogName;

    private final String databaseName;

    private final String schemaName;

    @NonNull private final String tableName;

    public TableIdentifier(
            String catalogName, String databaseName, String schemaName, @NonNull String tableName) {
        this.catalogName = catalogName;
        this.databaseName = databaseName;
        this.schemaName = schemaName;
        this.tableName = tableName;
        if (StringUtils.isEmpty(tableName)) {
            throw new IllegalArgumentException("tableName cannot be empty");
        }
    }

    public static TableIdentifier of(String catalogName, String databaseName, String tableName) {
        return new TableIdentifier(catalogName, databaseName, null, tableName);
    }

    public static TableIdentifier of(String catalogName, TablePath tablePath) {
        return new TableIdentifier(
                catalogName,
                tablePath.getDatabaseName(),
                tablePath.getSchemaName(),
                tablePath.getTableName());
    }

    public static TableIdentifier of(
            String catalogName, String databaseName, String schemaName, String tableName) {
        return new TableIdentifier(catalogName, databaseName, schemaName, tableName);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Pass a non-empty tableName when constructing TableIdentifier
  2. Validate/trim the table name from configs before calling of()/constructor
  3. If the table is genuinely unknown, fail earlier with a clearer error at config-parse time

Example fix

// before
TableIdentifier.of("MySQL", "shop", config.get("table")); // config value ""
// after
String table = config.getString("table");
if (table == null || table.isEmpty()) throw new IllegalArgumentException("table config is required");
TableIdentifier.of("MySQL", "shop", table);
Defensive patterns

Strategy: validation

Validate before calling

if (tableName == null || tableName.trim().isEmpty()) throw new IllegalArgumentException("tableName required");
TableIdentifier id = TableIdentifier.of(catalog, db, tableName);

Try / catch

try { return TableIdentifier.of(catalog, db, table); } catch (IllegalArgumentException e) { log.error("Cannot build TableIdentifier: {}", e.getMessage()); throw e; }

Prevention

When it happens

Trigger: Calling new TableIdentifier(catalog, db, schema, "") or TableIdentifier.of(...) with an empty/null tableName (null trips @NonNull first; empty string trips the isEmpty check).

Common situations: Building identifiers from parsed table paths where a segment is missing (e.g. splitting "db." or ".table"), dynamic table names taken from empty config fields, or default-initialized string variables.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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