apache/seatunnel · error · IllegalArgumentException

Cannot get split '%s' to get databaseName and tableName

Error message

Cannot get split '%s' to get databaseName and tableName

What it means

TablePath.of(String fullName) splits the full name on separators and only accepts 2 or 3 segments (db.table or db.schema.table). Anything else throws IllegalArgumentException telling you the string could not be split into database and table name.

Source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TablePath.java:68

        return of(fullName, false);
    }

    public static TablePath of(String fullName, boolean schemaFirst) {
        String[] paths = fullName.split("\\.");

        if (paths.length == 1) {
            return of(null, paths[0]);
        }
        if (paths.length == 2) {
            if (schemaFirst) {
                return of(null, paths[0], paths[1]);
            }
            return of(paths[0], null, paths[1]);
        }
        if (paths.length == 3) {
            return of(paths[0], paths[1], paths[2]);
        }
        throw new IllegalArgumentException(
                String.format("Cannot get split '%s' to get databaseName and tableName", fullName));
    }

    public static TablePath of(String databaseName, String tableName) {
        return of(databaseName, null, tableName);
    }

    public static TablePath of(String databaseName, String schemaName, String tableName) {
        return new TablePath(databaseName, schemaName, tableName);
    }

    public String getSchemaAndTableName() {
        return getNameCommon(null, schemaName, tableName, null, null);
    }

    public String getSchemaAndTableName(String quote) {
        return getNameCommon(null, schemaName, tableName, quote, quote);
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Use TablePath.of(databaseName, tableName) or of(db, schema, table) directly instead of a single ambiguous string
  2. Normalize the string to 2 or 3 dot-separated segments before calling of(fullName)
  3. If the table name itself contains dots, escape/split manually and use the multi-arg constructor

Example fix

// before
TablePath.of("mytable"); // throws
// after
TablePath.of("mydb", "mytable");
// or normalize first
String[] parts = fullName.split("\\.");
TablePath.of(parts[parts.length-2], parts[parts.length-1]);
Defensive patterns

Strategy: validation

Validate before calling

String[] parts = fullName.split("\\.");
if (parts.length < 2 || parts.length > 3) throw new IllegalArgumentException("Expected db.table or db.schema.table, got: " + fullName);

Try / catch

try { path = TablePath.of(fullName); } catch (IllegalArgumentException e) { log.error("Bad table path '{}': use db.table or db.schema.table", fullName); throw e; }

Prevention

When it happens

Trigger: Calling TablePath.of(fullName) where splitting yields 1 segment ("mytable"), or more than 3 segments ("a.b.c.d", e.g. names containing dots or JDBC-style prefixes).

Common situations: Passing bare table names from configs, passing fully-qualified names with extra qualifiers (cluster.db.schema.table), or names containing dots inside the table identifier.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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