apache/seatunnel · error · IllegalArgumentException

No hive tables matched the regex pattern. Please check `tabl

Error message

No hive tables matched the regex pattern. Please check `table_name` and `use_regex`. table_name=${tableNamePattern}

What it means

After querying the metastore with the compiled regex patterns, discovery expects at least one matching table. An empty result means either the pattern matched nothing or the database/table names differ from what the user assumed, so the connector fails fast with this error instead of producing a job that reads zero tables. The configured `table_name` is echoed to aid debugging.

Source

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

        }

        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());
        }
    }

    private void logMatchedTables(String tableNamePattern, List<TablePath> tablePaths) {
        String matchedTables =
                tablePaths.stream().map(TablePath::getFullName).collect(Collectors.joining(", "));
        log.info(
                "Hive regex discovery matched {} table(s) for table_name='{}': {}",
                tablePaths.size(),
                tableNamePattern,
                matchedTables);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Print/inspect available databases and tables in the metastore and adjust `table_name` regex to match real names
  2. Test the regex against actual table names (mind Java regex semantics and case sensitivity)
  3. Verify metastore_uri points to the intended cluster so discovery queries the right metastore
  4. Simplify the pattern to "db.\\.*" first, then narrow it down step by step

Example fix

// before
table_name = "Db1.USER_.*" // wrong case, matches nothing

// after
table_name = "db1.user_table_.*" // match lowercased Hive identifiers
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check pattern against metastore before submitting the job
try (HiveMetaStoreCatalog catalog = HiveMetaStoreCatalog.create(tableConfig)) {
    catalog.open();
    if (HiveSourceTableDiscovery.discoverTablePaths(tableConfig, catalog).isEmpty()) {
        throw new IllegalStateException("Pattern matches no tables: " + tableNamePattern);
    }
}

Try / catch

try {
    // submit job
} catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("No hive tables matched")) {
        // inspect metastore names, adjust table_name regex, resubmit
    }
}

Prevention

When it happens

Trigger: discoverTablePaths returns an empty list inside expandTableConfigIfNeeded — the compiled database/table regex matched no tables in the metastore reachable via metastore_uri.

Common situations: Typo in database or table regex; case sensitivity mismatch (Hive lowercases identifiers); regex anchors wrongly applied (e.g. pattern built for full-match vs find); metastore_uri points to a different cluster than expected; tables exist but pattern uses glob syntax instead of regex.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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