apache/seatunnel · error · IllegalArgumentException

Hive metastore_uri is required for regex table discovery (us

Error message

Hive metastore_uri is required for regex table discovery (use_regex). table_name=${tableNamePattern}

What it means

Regex table discovery (use_regex) is metastore-backed: the connector must connect to Hive to enumerate which tables match the pattern. expandTableConfigIfNeeded therefore requires a non-blank `metastore_uri` in the table config and throws this error when it is missing or blank, embedding the `table_name` pattern in the message.

Source

Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/source/config/MultipleTableHiveSourceConfig.java:93

    }

    private void parseFromLocalFileSourceByDiscovery(ReadonlyConfig readonlyConfig) {
        List<ReadonlyConfig> expanded = expandTableConfigIfNeeded(readonlyConfig);
        this.hiveSourceConfigs = buildHiveSourceConfigs(expanded);
    }

    private List<ReadonlyConfig> expandTableConfigIfNeeded(ReadonlyConfig tableConfig) {
        if (!HiveSourceTableDiscovery.isEnabled(tableConfig)) {
            return Lists.newArrayList(tableConfig);
        }

        String tableNamePattern =
                tableConfig
                        .getOptional(HiveSourceOptions.TABLE_NAME)
                        .orElse("<missing table_name>");
        if (!tableConfig.getOptional(HiveSourceOptions.METASTORE_URI).isPresent()
                || StringUtils.isBlank(tableConfig.get(HiveSourceOptions.METASTORE_URI))) {
            throw new IllegalArgumentException(
                    "Hive metastore_uri is required for regex table discovery (use_regex). table_name="
                            + tableNamePattern);
        }

        try (HiveMetaStoreCatalog catalog = HiveMetaStoreCatalog.create(tableConfig)) {
            catalog.open();
            List<TablePath> tablePaths =
                    HiveSourceTableDiscovery.discoverTablePaths(tableConfig, catalog);
            if (tablePaths.isEmpty()) {
                throw new IllegalArgumentException(
                        "No hive tables matched the regex pattern. Please check `table_name` and `use_regex`. table_name="
                                + tableNamePattern);
            }
            logMatchedTables(tableNamePattern, tablePaths);
            return tablePaths.stream()
                    .map(path -> overrideTableName(tableConfig, path.getFullName()))
                    .collect(Collectors.toList());
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Add `metastore_uri = "thrift://<metastore-host>:9083"` to the Hive source config
  2. Verify the value is non-blank after variable substitution in templated configs
  3. If the metastore is truly unavailable, use explicit `table_name`-style plain table configs without use_regex

Example fix

// before
use_regex = true
table_name = "db0.\\.*"

// after
use_regex = true
table_name = "db0.\\.*"
metastore_uri = "thrift://metastore-host:9083"
Defensive patterns

Strategy: validation

Validate before calling

if (config.get(HiveSourceOptions.USE_REGEX)
        && !config.getOptional(HiveSourceOptions.METASTORE_URI).map(u -> !u.trim().isEmpty()).orElse(false)) {
    throw new IllegalArgumentException("metastore_uri is required when use_regex=true");
}

Prevention

When it happens

Trigger: MultipleTableHiveSourceConfig.expandTableConfigIfNeeded processes a table config with use_regex=true where HiveSourceOptions.METASTORE_URI is absent or its value is blank.

Common situations: Local/HDFS-only Hive configs that never needed metastore_uri now enable use_regex; kerberos/remote metastore migration drops the URI; template config leaves metastore_uri empty.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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