apache/seatunnel · critical · IOException

Invalid state: currentSplitId is null when emitting records.

Error message

Invalid state: currentSplitId is null when emitting records. emittedFinishedSplitId=%s, currentFetcher=%s, isFinished=%s

What it means

IncrementalSourceSplitReader.fetch() encountered a state where it must emit records but currentSplitId is null — meaning no split is currently assigned to this reader. This indicates an internal coordination bug or race in split assignment/handover between the enumerator and reader, so it throws IOException to fail the task rather than silently emitting to an unknown split.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/source/reader/IncrementalSourceSplitReader.java:106

        }
        Iterator<SourceRecords> dataIt = null;
        try {
            dataIt = currentFetcher.pollSplitRecords();
        } catch (InterruptedException | SeaTunnelException e) {
            log.warn("fetch data failed.", e);
            throw new IOException(e);
        }
        if (dataIt == null) {
            return finishedSnapshotSplit();
        }
        if (currentSplitId == null) {
            log.warn(
                    "Invalid state: currentSplitId is null when emitting records. "
                            + "emittedFinishedSplitId={}, currentFetcher={}, isFinished={}",
                    emittedFinishedSplitId,
                    currentFetcher != null ? currentFetcher.getClass().getSimpleName() : "null",
                    currentFetcher != null && currentFetcher.isFinished());
            throw new IOException(
                    String.format(
                            "Invalid state: currentSplitId is null when emitting records. "
                                    + "emittedFinishedSplitId=%s, currentFetcher=%s, isFinished=%s",
                            emittedFinishedSplitId,
                            currentFetcher != null
                                    ? currentFetcher.getClass().getSimpleName()
                                    : "null",
                            currentFetcher != null && currentFetcher.isFinished()));
        }
        return ChangeEventRecords.forRecords(currentSplitId, dataIt);
    }

    @Override
    public void handleSplitsChanges(SplitsChange<SourceSplitBase> splitsChanges) {
        if (!(splitsChanges instanceof SplitsAddition)) {
            throw new UnsupportedOperationException(
                    String.format(
                            "The SplitChange type of %s is not supported.",

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Restart the job from the last successful checkpoint/savepoint to realign enumerator and reader state
  2. Reproduce with debug logging on split assignment (log.debug "Handling split change") to see whether splits were delivered
  3. Check for reported connector/engine bugs around split handover and upgrade SeaTunnel if fixed upstream
  4. Reduce checkpoint frequency of split state changes or reduce split count per table to narrow the race window
Defensive patterns

Strategy: try-catch

Type guard

boolean hasAssignedSplit(IncrementalSourceSplitReader r) { return r != null && r.getCurrentSplitId() != null; }

Try / catch

try { records = reader.fetch(); }
catch (IOException e) {
  if (e.getMessage().contains("currentSplitId is null")) {
    restartFromLastCheckpoint(); // realign enumerator/reader state
  } else { throw e; }
}

Prevention

When it happens

Trigger: fetch() -> getRecords() finds currentSplitId == null while records must be emitted; happens after a split finished and was acknowledged but the next split wasn't assigned yet, or on restore when split state and reader state diverged.

Common situations: Checkpoint/restore state corruption or version mismatch; race between handleSplitsChanges and fetch; a bug triggered by rapid split handover (many tiny snapshot splits); engine restart mid-split-transition.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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