apache/flink · error · UnsupportedOperationException

The SplitChange type of %s is not supported.

Error message

The SplitChange type of %s is not supported.

What it means

FileSourceSplitReader implements handleSplitsChanges to accept new file splits from the enumerator at runtime (SplitsAddition). It does not support any other SplitsChange subtype — most notably SplitsRemoval — because the file source does not support removing already-assigned splits during execution. Any non-SplitsAddition change triggers an UnsupportedOperationException.

Source

Thrown at flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/impl/FileSourceSplitReader.java:76

        this.config = config;
        this.readerFactory = readerFactory;
        this.splits = new ArrayDeque<>();
    }

    @Override
    public RecordsWithSplitIds<RecordAndPosition<T>> fetch() throws IOException {
        checkSplitOrStartNext();

        final BulkFormat.RecordIterator<T> nextBatch = currentReader.readBatch();
        return nextBatch == null
                ? finishSplit()
                : FileRecords.forRecords(currentSplitId, nextBatch);
    }

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

        LOG.debug("Handling split change {}", splitChange);
        splits.addAll(splitChange.splits());
    }

    @Override
    public void wakeUp() {}

    @Override
    public void close() throws Exception {
        if (currentReader != null) {
            currentReader.close();
        }
    }

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Ensure only SplitsAddition events are forwarded to FileSourceSplitReader; filter out other SplitsChange types before calling handleSplitsChanges.
  2. If split removal is required, use a custom SourceReader implementation that handles removal natively instead of delegating to FileSourceSplitReader.
  3. Check the framework/Source integration code that dispatches SplitsChange objects and confirm it only produces SplitsAddition for file sources.

Example fix

// before
reader.handleSplitsChanges(splitChange);

// after
if (splitChange instanceof SplitsAddition) {
    reader.handleSplitsChanges(splitChange);
} else {
    LOG.warn("Ignoring unsupported split change type: {}", splitChange.getClass());
}
Defensive patterns

Strategy: type-guard

Validate before calling

// Filter split changes before forwarding to FileSourceSplitReader
if (splitChange instanceof SplitsAddition) {
    reader.handleSplitsChanges(splitChange);
} else {
    LOG.warn("FileSourceSplitReader only supports SplitsAddition; ignoring {}", splitChange.getClass());
}

Type guard

boolean isSplitsAddition(SplitsChange<?> change) {
    return change instanceof SplitsAddition;
}

Prevention

When it happens

Trigger: The framework sends a SplitsChange to the reader that is not an instance of SplitsAddition. This typically happens when a custom Source or framework logic attempts to remove splits from a FileSourceSplitReader. In standard Flink usage the enumerator only sends SplitsAddition events; this error surfaces when custom source integration or a framework path sends removal or other change types.

Common situations: Custom source wrapper that wraps a FileSourceSplitReader and forwards split changes including removals. Framework version change that introduces new SplitsChange subtypes. Integration with a system that attempts to revoke file splits (e.g. file deletion mid-job).

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/914788e744069660. Report an issue: GitHub.