{"record":{"id":"b1a76f482089f73d","repo":"apache/seatunnel","slug":"fetch-data-failed","errorCode":null,"errorMessage":"fetch data failed.","messagePattern":"fetch data failed\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/source/reader/IncrementalSourceSplitReader.java","lineNumber":93,"sourceCode":"        this.splits = new ArrayDeque<>();\n        this.dataSourceDialect = dataSourceDialect;\n        this.sourceConfig = sourceConfig;\n        this.schemaChangeResolver = schemaChangeResolver;\n    }\n\n    @Override\n    public RecordsWithSplitIds<SourceRecords> fetch() throws IOException {\n\n        checkSplitOrStartNext();\n        checkNeedStopBinlogReader();\n        if (hasEmittedCurrentSplitFinished()) {\n            return NoSplitRecords.INSTANCE;\n        }\n        Iterator<SourceRecords> dataIt = null;\n        try {\n            dataIt = currentFetcher.pollSplitRecords();\n        } catch (InterruptedException | SeaTunnelException e) {\n            log.warn(\"fetch data failed.\", e);\n            throw new IOException(e);\n        }\n        if (dataIt == null) {\n            return finishedSnapshotSplit();\n        }\n        if (currentSplitId == null) {\n            log.warn(\n                    \"Invalid state: currentSplitId is null when emitting records. \"\n                            + \"emittedFinishedSplitId={}, currentFetcher={}, isFinished={}\",\n                    emittedFinishedSplitId,\n                    currentFetcher != null ? currentFetcher.getClass().getSimpleName() : \"null\",\n                    currentFetcher != null && currentFetcher.isFinished());\n            throw new IOException(\n                    String.format(\n                            \"Invalid state: currentSplitId is null when emitting records. \"\n                                    + \"emittedFinishedSplitId=%s, currentFetcher=%s, isFinished=%s\",\n                            emittedFinishedSplitId,\n                            currentFetcher != null","sourceCodeStart":75,"sourceCodeEnd":111,"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/reader/IncrementalSourceSplitReader.java#L75-L111","documentation":"IncrementalSourceSplitReader.fetch() polls CDC records from the current incremental fetcher. If pollSplitRecords() throws InterruptedException or SeaTunnelException, it logs 'fetch data failed.' and wraps the cause in an IOException, which fails the source reader and ultimately the job. This is a transport/connector-level failure of the CDC record poll loop.","triggerScenarios":"pollSplitRecords() throws while reading from the upstream database log (MySQL binlog, etc.): connection drop to the database, binlog position no longer available (binlog purged/GTID gap), timeout, or the underlying Debezium fetcher erroring during snapshot/streaming. Interrupted while blocking on the poll (task cancellation).","commonSituations":"Database restarted or network blip between worker and MySQL; binlog files purged before the reader caught up; user permissions revoked mid-run (binlog access lost); firewall/load-balancer idle timeout killing long-lived CDC connection; job cancelled leading to InterruptedException.","solutions":["Inspect the wrapped cause (IOException.getCause()) for the root database error and fix accordingly (connectivity, credentials, binlog).","Ensure binlog retention (expire_logs_days / binlog_expire_logs_seconds) is long enough to cover pause/backlog; restart from a valid checkpoint.","Add retry/resume from checkpoint: rerun the job from its last savepoint/checkpoint rather than scratch.","Verify database user still has REPLICATION SLAVE/CLIENT and SELECT privileges.","Increase network timeouts / keepalives between the SeaTunnel worker and the database."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before submitting: verify connectivity and privileges\n// mysql -h host -u cdc_user -p -e \"SHOW GRANTS FOR CURRENT_USER;\"  \n// and check: SHOW VARIABLES LIKE 'binlog_expire_logs_seconds';","typeGuard":null,"tryCatchPattern":"try {\n    reader.pollSplitRecords();\n} catch (IOException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof InterruptedException) {\n        // expected on cancel — do not retry\n    } else {\n        // transient DB/network error — retry with backoff from checkpoint\n    }\n}","preventionTips":["Set binlog retention well beyond expected job downtime","Use stable network paths / increase TCP keepalive for long CDC connections","Monitor and re-run from checkpoints instead of restarting from scratch","Keep CDC user privileges (REPLICATION SLAVE, SELECT) stable across the run"],"tags":["cdc","network","fetch","io"],"backgroundTag":"network-request-failed","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"}