apache/seatunnel · error · UnsupportedOperationException

The SplitChange type of %s is not supported.

Error message

The SplitChange type of %s is not supported.

What it means

KafkaSource's KafkaPartitionSplitReader only implements incremental split assignment via SplitsAddition. Any other SplitsChange subtype (e.g. SplitsRemove) is rejected with UnsupportedOperationException because removal/rebalancing of already-assigned splits is not supported by this reader.

Source

Thrown at seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaPartitionSplitReader.java:167

                currentOffset);
        finishedPartitions.add(tp);
        recordsBySplits.addFinishedSplit(tp.toString());
    }

    private void markEmptySplitsAsFinished(KafkaPartitionSplitRecords recordsBySplits) {
        // Some splits are discovered as empty when handling split additions. These splits should be
        // added to finished splits to clean up states in split fetcher and source reader.
        if (!emptySplits.isEmpty()) {
            recordsBySplits.finishedSplits.addAll(emptySplits);
            emptySplits.clear();
        }
    }

    @Override
    public void handleSplitsChanges(SplitsChange<KafkaSourceSplit> splitsChange) {
        // Get all the partition assignments and stopping offsets.
        if (!(splitsChange instanceof SplitsAddition)) {
            throw new UnsupportedOperationException(
                    String.format(
                            "The SplitChange type of %s is not supported.",
                            splitsChange.getClass()));
        }

        // Assignment.
        List<TopicPartition> newPartitionAssignments = new ArrayList<>();
        // Starting offsets.
        Map<TopicPartition, Long> partitionsStartingOffsets = new HashMap<>();
        // Stopping offsets.
        List<TopicPartition> partitionsStoppingAtLatest = new ArrayList<>();

        // Parse the starting and stopping offsets.
        splitsChange
                .splits()
                .forEach(
                        s -> {
                            newPartitionAssignments.add(s.getTopicPartition());

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Ensure split changes sent to the Kafka source reader are SplitsAddition instances only.
  2. If split removal is needed, recreate the job or use a source implementation that supports SplitsRemove.
  3. Check the engine/connector version pairing so the split-change protocol matches what KafkaSourceReader supports.

Example fix

// before
splitsChanges.add(new SplitsRemove<>(removedSplits));
// after
splitsChanges.add(new SplitsAddition<>(addedSplits)); // Kafka reader supports additions only
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(splitsChange instanceof SplitsAddition)) { throw new IllegalArgumentException("Kafka reader only accepts SplitsAddition, got: " + splitsChange.getClass()); }

Type guard

boolean isAddition(SplitsChange<?> c) { return c instanceof SplitsAddition; }

Try / catch

try { reader.handleSplitsChanges(change); } catch (UnsupportedOperationException e) { log.error("Unsupported split change type", e); }

Prevention

When it happens

Trigger: Calling handleSplitsChanges on KafkaPartitionSplitReader with a SplitsChange that is not an instance of SplitsAddition<KafkaSourceSplit>, e.g. a SplitsRemove produced during dynamic split removal or a custom SourceReader implementation passing an unsupported change type.

Common situations: Engine or framework code performing split removals after a reader scale-down or failed assignment; custom readers wrapping Kafka source splits; framework versions where the split change protocol changed.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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