{"record":{"id":"752be28e7b753b03","repo":"apache/seatunnel","slug":"failed-to-discover-remaining-tables-to-capture","errorCode":null,"errorMessage":"Failed to discover remaining tables to capture","messagePattern":"Failed to discover remaining tables to capture","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/source/enumerator/SnapshotSplitAssigner.java","lineNumber":162,"sourceCode":"        LOG.info(\n                \"SnapshotSplitAssigner created with assigned splits: {}\",\n                this.assignedSplits.keySet());\n    }\n\n    @Override\n    public void open() {\n        chunkSplitter = dialect.createChunkSplitter(sourceConfig);\n\n        // the legacy state didn't snapshot remaining tables, discovery remaining table here\n        if (!isRemainingTablesCheckpointed && !assignerCompleted) {\n            try {\n                final List<TableId> discoverTables = dialect.discoverDataCollections(sourceConfig);\n                context.getCapturedTables().addAll(discoverTables);\n                discoverTables.removeAll(alreadyProcessedTables);\n                this.remainingTables.addAll(discoverTables);\n                this.isTableIdCaseSensitive = dialect.isDataCollectionIdCaseSensitive(sourceConfig);\n            } catch (Exception e) {\n                throw new RuntimeException(\"Failed to discover remaining tables to capture\", e);\n            }\n        }\n    }\n\n    @Override\n    public Optional<SourceSplitBase> getNext() {\n        if (chunkSplitter == null) {\n            return Optional.empty();\n        }\n        if (!remainingSplits.isEmpty()) {\n            // return remaining splits firstly\n            Iterator<SnapshotSplit> iterator = remainingSplits.iterator();\n            SnapshotSplit split = iterator.next();\n            iterator.remove();\n            assignedSplits.put(split.splitId(), split);\n            context.getAssignedSnapshotSplit().put(split.splitId(), split);\n            return Optional.of(split);\n        } else {","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/source/enumerator/SnapshotSplitAssigner.java#L144-L180","documentation":"Thrown by SnapshotSplitAssigner.open() when dialect.discoverDataCollections(sourceConfig) fails while enumerating the tables the CDC job should capture. It wraps the underlying exception (usually a JDBC/metadata-connection failure), so the root cause is the chained cause. This happens during split-assigner initialization, before any snapshot work starts.","triggerScenarios":"open() calls dialect.discoverDataCollections(sourceConfig) and any exception (JDBC connect failure, bad credentials, table-listing query failure, malformed table-name config) is wrapped and rethrown as RuntimeException.","commonSituations":"Wrong hostname/port in the database config; credentials lacking metadata-read privileges; database unreachable or firewall-blocked; include/exclude table patterns matching nothing or invalid syntax; database server temporarily down at job start.","solutions":["Inspect the wrapped cause exception in the stack trace to identify the real failure (connection vs query vs auth)","Verify database connectivity (host, port, credentials) with a plain JDBC client or mysql/psql","Check that the table include/exclude patterns and database names in the connector config are valid and match at least one table","Grant the CDC user permission to read metadata (e.g. SELECT on information_schema / SHOW DATABASES)","Retry once the database is reachable if this was a transient outage"],"exampleFix":"// before (job fails with wrapped discovery error)\n// source:\n//   tables = \"orders_*\"   (pattern typo: no tables matched / invalid query)\n// after:\n//   tables = \"order.*\"    (correct regex, table discovery succeeds)","handlingStrategy":"validation","validationCode":"// Before submitting the CDC job:\n// mysql -h $HOST -P $PORT -u $USER -p -e \"SELECT 1 FROM information_schema.tables LIMIT 1;\"\n// Fail fast if DB unreachable or user lacks metadata privileges.\ntry (Connection c = DriverManager.getConnection(url, user, pass)) {\n    c.createStatement().execute(\"SELECT 1 FROM information_schema.tables LIMIT 1\");\n}","typeGuard":null,"tryCatchPattern":"try { assigner.open(); } catch (RuntimeException e) {\n    LOG.error(\"Table discovery failed; root cause: {}\", e.getCause(), e);\n    throw e;\n}","preventionTips":["Validate DB connectivity and credentials before submitting the job","Test table include/exclude regexes against real table names","Grant CDC user metadata-read (SELECT on information_schema) privileges","Add retry/backoff for transient DB outages at job startup"],"tags":["jdbc","cdc","table-discovery","connection"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}