apache/iceberg · error · UnsupportedOperationException

WriterSink is used only for writing; committing is handled…

Error message

WriterSink is used only for writing; committing is handled by the main sink

What it means

In the dynamic sink's split writer/follower topology, the WriterSink branch only produces write results; committing is the responsibility of the main sink operator. Its FlinkSinkBuilder/createCommitter hook therefore unconditionally throws UnsupportedOperationException if a committer is requested. This is a programming-model guard: constructing a committer on the writer branch is never valid.

Solutions

  1. Do not attach a committer to the WriterSink branch; let the main sink operator perform commits
  2. Check sink topology setup code so committer construction is only invoked for the main sink
  3. If using sink v2 APIs, ensure the write-branch uses only the writer/(writer sink) and the committable flow is wired to the dedicated committer operator
Defensive patterns

Strategy: validation

Validate before calling

// Configure the sink so committer creation only happens for the main sink operator,
// never for the WriterSink write branch.

Try / catch

try {
  committer = writerSink.createCommitter(ctx);
} catch (UnsupportedOperationException e) {
  // wrong branch: use the main sink's committer instead
}

Prevention

When it happens

Trigger: Calling createCommitter() on the WriterSink's write-branch operator, e.g. by configuring the sink so the framework tries to instantiate a committer for the writing subtasks, or custom code invoking the builder's committer hook on this branch.

Common situations: Misconfiguring the DynamicIcebergSink topology so the writer subtasks are also asked to commit; upgrading Flink sink APIs where committer placement changed and generic glue code calls createCommitter on all operators.

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/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/7c6dc462b8464e08. Report an issue: GitHub.

Appendix: source

Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicIcebergSink.java:221

      this.cacheMaximumSize = cacheMaximumSize;
    }

    @SuppressWarnings("deprecation")
    @Override
    public SinkWriter<DynamicRecordInternal> createWriter(InitContext context) throws IOException {
      return new DynamicWriter(
          catalogLoader.loadCatalog(),
          writeProperties,
          flinkConfig,
          cacheMaximumSize,
          new DynamicWriterMetrics(context.metricGroup()),
          context.getSubtaskId(),
          context.getAttemptNumber());
    }

    @Override
    public Committer<DynamicWriteResult> createCommitter(CommitterInitContext context) {
      throw new UnsupportedOperationException(
          "WriterSink is used only for writing; committing is handled by the main sink");
    }

    @Override
    public SimpleVersionedSerializer<DynamicWriteResult> getCommittableSerializer() {
      return new DynamicWriteResultSerializer();
    }
  }

  public static class Builder<T> {
    private DataStream<T> input;
    private DynamicRecordGenerator<T> generator;
    private CatalogLoader catalogLoader;
    private String uidPrefix = null;
    private final Map<String, String> writeOptions = Maps.newHashMap();
    private final Map<String, String> snapshotSummary = Maps.newHashMap();
    private ReadableConfig readableConfig = new Configuration();
    private TableCreator tableCreator = TableCreator.DEFAULT;

View on GitHub (pinned to 86d9c8fc54)