apache/iceberg · error · UnsupportedOperationException

The method stop() is deprecated and will be removed in…

Error message

The method stop() is deprecated and will be removed in 2.0.0. Use stop(Collection<TopicPartition>) instead.

What it means

CommitterImpl.stop() with no arguments is the deprecated lifecycle hook and now throws UnsupportedOperationException unconditionally. Stopping the committer requires knowing which partitions are closing so in-flight coordinator work can be drained correctly; callers must migrate to stop(Collection<TopicPartition>).

Solutions

  1. Call stop(Collection<TopicPartition>) with the partitions being closed in this rebalance/shutdown.
  2. Align the Kafka Connect runtime version with the Iceberg sink connector so the framework uses the partition-aware stop overload.
  3. Update any custom code wrapping CommitterImpl to pass closedPartitions through instead of the no-arg stop().

Example fix

// before
committer.stop();

// after
committer.stop(closedPartitions);
Defensive patterns

Strategy: validation

Validate before calling

// Java
if (closedPartitions == null) {
  throw new IllegalArgumentException("closedPartitions required: use stop(Collection<TopicPartition>)");
}
committer.stop(closedPartitions);

Try / catch

try { committer.stop(closedPartitions); } catch (UnsupportedOperationException e) { throw new IllegalStateException("Legacy stop() invoked — update task wrapper", e); }

Prevention

When it happens

Trigger: Kafka Connect calls the parameterless Committer.stop() when pausing or shutting down the sink task, instead of stop(Collection<TopicPartition>) with the set of closed partitions.

Common situations: Version mismatch between the Kafka Connect runtime and the Iceberg sink connector's Committer interface; custom task wrappers calling stop() directly during task rebalance or connector teardown.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/4ebd9e66f719b753. Report an issue: GitHub.

Appendix: source

Thrown at kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/CommitterImpl.java:155

            + "Use start(Catalog, IcebergSinkConfig, SinkTaskContext, Collection<TopicPartition>) instead.");
  }

  @Override
  public void open(
      Catalog icebergCatalog,
      IcebergSinkConfig icebergSinkConfig,
      SinkTaskContext sinkTaskContext,
      Collection<TopicPartition> addedPartitions) {
    initialize(icebergCatalog, icebergSinkConfig, sinkTaskContext);
    if (hasLeaderPartition(addedPartitions)) {
      LOG.info("Committer {} received leader partition. Starting Coordinator.", taskId);
      startCoordinator();
    }
  }

  @Override
  public void stop() {
    throw new UnsupportedOperationException(
        "The method stop() is deprecated and will be removed in 2.0.0. "
            + "Use stop(Collection<TopicPartition>) instead.");
  }

  @Override
  public void close(Collection<TopicPartition> closedPartitions) {
    // Always try to stop the worker to avoid duplicates.
    stopWorker();

    // Defensive: close called without prior initialization (should not happen).
    if (!isInitialized.get()) {
      LOG.warn("Close unexpectedly called on committer {} without partition assignment", taskId);
      return;
    }

    // Empty partitions → task was stopped explicitly. Stop coordinator if running.
    if (closedPartitions.isEmpty()) {
      LOG.info("Committer {} stopped. Closing coordinator.", taskId);

View on GitHub (pinned to 86d9c8fc54)