apache/seatunnel · error · IllegalArgumentException

`table_path` and `sql` parameter cannot be both empty.

Error message

`table_path` and `sql` parameter cannot be both empty.

What it means

After ClickhouseTableConfig.of builds the table list, it validates each entry: a table config must supply at least one of table_path or sql. If both are empty it throws IllegalArgumentException with this message. Unlike error 658 this is a per-entry validation, so one bad entry in table_list fails the whole config.

Source

Thrown at seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/config/ClickhouseTableConfig.java:105

                            .batchSize(readonlyConfig.get(CLICKHOUSE_BATCH_SIZE))
                            .splitSize(readonlyConfig.get(CLICKHOUSE_SPLIT_SIZE))
                            .build();

            tableList = Collections.singletonList(tableConfig);
        }

        if (tableList == null || tableList.isEmpty()) {
            throw new ClickhouseConnectorException(
                    ClickhouseConnectorErrorCode.GET_TABLE_LIST_CONFIG_ERROR,
                    String.format(
                            "PluginName: %s, PluginType: %s, Message: %s",
                            "Clickhouse", PluginType.SOURCE, "Get table list config error."));
        }

        for (ClickhouseTableConfig tableConfig : tableList) {
            if (StringUtils.isEmpty(tableConfig.getTablePath())
                    && StringUtils.isEmpty(tableConfig.getSql())) {
                throw new IllegalArgumentException(
                        "`table_path` and `sql` parameter cannot be both empty.");
            }

            if (tableConfig.getBatchSize() <= 0) {
                tableConfig.setBatchSize(CLICKHOUSE_BATCH_SIZE.defaultValue());
            }

            if (tableConfig.getSplitSize() <= 0) {
                tableConfig.setSplitSize(CLICKHOUSE_SPLIT_SIZE.defaultValue());
            }

            tableConfig.setSqlStrategyRead(StringUtils.isNotEmpty(tableConfig.getSql()));
        }

        return tableList;
    }

    public TablePath getTableIdentifier() {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set a non-empty table_path for every table_list entry (e.g. "database.table").
  2. Or provide a non-empty 'sql' for the entry instead of table_path.
  3. Validate the generated config: ensure template variables used in table_path actually resolve to non-empty values.
  4. Add pre-flight config validation in your deployment pipeline to reject entries missing both fields before job submission.

Example fix

// before
table_list = [
  { database_name = "default", table_name = "" }
]
// after
table_list = [
  { table_path = "default.my_table" }
]
Defensive patterns

Strategy: validation

Validate before calling

boolean hasTablePath = config.containsKey("table_path") && !config.getString("table_path", "").trim().isEmpty();
boolean hasSql = config.containsKey("sql") && !config.getString("sql", "").trim().isEmpty();
if (!hasTablePath && !hasSql) { throw new IllegalArgumentException("Each table entry needs non-empty table_path or sql"); }

Try / catch

try { tableConfigs = ClickhouseTableConfig.of(readonlyConfig); } catch (IllegalArgumentException e) { if (e.getMessage().contains("table_path` and `sql")) { log.error("A table_list entry is missing both table_path and sql"); } throw e; }

Prevention

When it happens

Trigger: A table_list entry (or single-table config parsed from a plugin-level path) where both getTablePath() and getSql() return empty strings/null — e.g. a table_list element that specifies only connection options, or table_path present but blank ("" or whitespace).

Common situations: table_list entries with an empty table_path string; users intending 'read everything' by leaving table_path blank; blank value from a templated config where a variable expanded to empty string; setting neither sql nor table_path inside a multi-table config.

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