{"record":{"id":"b7a2b139e00b33db","repo":"apache/seatunnel","slug":"when-use-regex-is-enabled-table-name-must-be","errorCode":null,"errorMessage":"When `use_regex` is enabled, `table_name` must be configured","messagePattern":"When `use_regex` is enabled, `table_name` must be configured","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/source/config/HiveSourceTableDiscovery.java","lineNumber":52,"sourceCode":"@UtilityClass\npublic class HiveSourceTableDiscovery {\n\n    public static boolean isEnabled(ReadonlyConfig config) {\n        return config != null && config.get(HiveSourceOptions.USE_REGEX);\n    }\n\n    public static List<TablePath> discoverTablePaths(ReadonlyConfig config, Catalog catalog) {\n        if (config == null || catalog == null) {\n            return Collections.emptyList();\n        }\n\n        if (!config.get(HiveSourceOptions.USE_REGEX)) {\n            return Collections.emptyList();\n        }\n\n        String patternStr = config.getOptional(HiveSourceOptions.TABLE_NAME).orElse(null);\n        if (patternStr == null || patternStr.trim().isEmpty()) {\n            throw new IllegalArgumentException(\n                    \"When `use_regex` is enabled, `table_name` must be configured\");\n        }\n\n        HiveTableNamePattern tableNamePattern = HiveTableNamePattern.parse(patternStr);\n        Pattern databasePattern = compilePattern(tableNamePattern.getDatabasePattern(), patternStr);\n        Pattern tablePattern = compilePattern(tableNamePattern.getTablePattern(), patternStr);\n\n        List<TablePath> tablePaths = new ArrayList<>();\n        String databasePatternStr = tableNamePattern.getDatabasePattern();\n        if (isExactDatabaseName(databasePatternStr)) {\n            String databaseName = databasePatternStr;\n            for (String tableName : catalog.listTables(databaseName)) {\n                if (tablePattern.matcher(tableName).matches()) {\n                    tablePaths.add(TablePath.of(databaseName, tableName));\n                }\n            }\n        } else {\n            for (String databaseName : catalog.listDatabases()) {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/source/config/HiveSourceTableDiscovery.java#L34-L70","documentation":"When `use_regex = true`, Hive table discovery uses the `table_name` option as a regex pattern (`databasePattern.tablePattern`) to filter metastore tables. This error is thrown from discoverTablePaths when the option is absent or blank, because there is no pattern to compile or match against. It is an explicit configuration sanity check before touching the Hive metastore.","triggerScenarios":"Calling HiveSourceTableDiscovery.discoverTablePaths (directly or via MultipleTableHiveSourceConfig.expandTableConfigIfNeeded) with a config where HiveSourceOptions.USE_REGEX is true but HiveSourceOptions.TABLE_NAME is missing, null, or whitespace-only.","commonSituations":"Users enable `use_regex = true` to bulk-read tables but forget the `table_name` option; a templated/generated HOCON config leaves `table_name` empty; a refactor renames the option so the value falls back to default null.","solutions":["Set `table_name` in the Hive source config, e.g. table_name = \"db0.\\\\.*\"","Disable `use_regex` (set it to false or remove it) if you intend to read an explicit table list instead","Validate the config before submitting: ensure table_name is present and non-blank whenever use_regex is true"],"exampleFix":"// before\nuse_regex = true\n// (no table_name)\n\n// after\nuse_regex = true\ntable_name = \"db0.\\\\.*\"","handlingStrategy":"validation","validationCode":"if (config.get(HiveSourceOptions.USE_REGEX)\n        && !config.getOptional(HiveSourceOptions.TABLE_NAME).map(s -> !s.trim().isEmpty()).orElse(false)) {\n    throw new IllegalArgumentException(\"use_regex=true requires a non-blank table_name\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair use_regex=true with a table_name pattern","Validate HOCON templates after variable substitution","Prefer explicit table lists when only one table is read"],"tags":["hive","config","regex","missing-option"],"backgroundTag":"missing-required-config-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}