{"record":{"id":"cdcba5122c917afa","repo":"apache/seatunnel","slug":"failed-to-process-regex-table-path","errorCode":null,"errorMessage":"Failed to process regex table path: ","messagePattern":"Failed to process regex table path: ","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/JdbcCatalogUtils.java","lineNumber":594,"sourceCode":"                        JdbcSourceTable.builder()\n                                .tablePath(path)\n                                .partitionColumn(tableConfig.getPartitionColumn())\n                                .partitionNumber(tableConfig.getPartitionNumber())\n                                .partitionStart(tableConfig.getPartitionStart())\n                                .partitionEnd(tableConfig.getPartitionEnd())\n                                .useSelectCount(tableConfig.getUseSelectCount())\n                                .skipAnalyze(tableConfig.getSkipAnalyze())\n                                .catalogTable(catalogTable)\n                                .build();\n\n                result.put(path, jdbcSourceTable);\n                log.info(\"Found table matching regex pattern: {}\", path);\n            }\n\n            log.info(\"Found {} tables matching regex pattern: {}\", catalogTables.size(), tablePath);\n        } catch (Exception e) {\n            log.warn(\"Error processing table path with regex: {}\", tablePath, e);\n            throw new SQLException(\"Failed to process regex table path: \" + tablePath, e);\n        }\n    }\n}\n","sourceCodeStart":576,"sourceCodeEnd":598,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/JdbcCatalogUtils.java#L576-L598","documentation":"When a table_path contains a regex pattern, processRegexTablePath lists catalog tables via JDBC metadata and filters them against the pattern. Any exception during listing/matching (metadata query failure, malformed pattern, connection problems) is caught, logged as a warning, and rethrown as a SQLException 'Failed to process regex table path: <path>'.","triggerScenarios":"getTables is called with a regex table path and an inner exception occurs: database metadata call fails (connection dropped, missing privileges), the regex is invalid (PatternSyntaxException), or catalog/schema lookups throw.","commonSituations":"Typos in regex producing PatternSyntaxException (unbalanced brackets); user lacking metadata-listing privileges on the catalog; transient network failures during metadata retrieval; regex matching zero tables then downstream assumptions failing.","solutions":["Check the logged WARN stack trace (Error processing table path with regex) for the root cause","Validate the regex independently (compile it in a REPL or regex tool) before putting it in table_path","Grant the connecting user permission to list tables in the target catalog/schema, and verify the connection is healthy","If you don't need pattern matching, use an explicit table_path instead"],"exampleFix":"// before\ntable_path = \"mydb.log_[2024-(\" // unbalanced paren -> PatternSyntaxException\n// after\ntable_path = \"mydb.log_2024_[0-9]+\" // valid regex","handlingStrategy":"validation","validationCode":"try {\n  java.util.regex.Pattern.compile(tablePath); // throws PatternSyntaxException early\n} catch (java.util.regex.PatternSyntaxException e) {\n  throw new IllegalArgumentException(\"Invalid table_path regex: \" + tablePath, e);\n}\n// also pre-test metadata access:\ntry (var rs = connection.getMetaData().getTables(catalog, schema, \"%\", new String[]{\"TABLE\"})) {\n  if (!rs.isBeforeFirst()) log.warn(\"No tables visible to user — check privileges\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  jdbcSource.open(...); // triggers table discovery\n} catch (SQLException e) {\n  if (e.getMessage().startsWith(\"Failed to process regex table path\")) {\n    log.error(\"Inspect WARN 'Error processing table path with regex' for root cause\", e);\n  }\n}","preventionTips":["Test regex patterns before using them in table_path","Grant metadata-listing privileges to the connector user","Prefer explicit table_path when pattern matching isn't needed","Keep connections alive during discovery (metadata listing can be slow)"],"tags":["jdbc","regex","metadata","table-discovery"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}