apache/iceberg · error · UnsupportedOperationException

String.format("Cannot commit to branch : does not support…

Error message

String.format("Cannot commit to branch %s: %s does not support branch commits", branch, this.getClass().getName())

What it means

Default-method guard on SnapshotUpdate.toBranch: the snapshot-producing operation does not support committing to a named branch. The message includes both the target branch name and the runtime class name, so the caller can tell which operation lacks branch-commit support. It fires on any toBranch call when unimplemented, regardless of branch validity.

Solutions

  1. Commit to the table's main branch and use manageSnapshots/refs to move a branch afterward
  2. Catch UnsupportedOperationException and surface that branch commits are unsupported for this operation
  3. Use an operation implementation that overrides toBranch
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at api/src/main/java/org/apache/iceberg/SnapshotUpdate.java:86 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at api/src/main/java/org/apache/iceberg/SnapshotUpdate.java:86

   * number of manifest files produced. The executor provides the threads for parallel execution.
   *
   * @param executorService the provided executor
   * @param parallelism the number of parallel manifest writers to use
   * @return this for method chaining
   */
  default ThisT writeManifestsWith(ExecutorService executorService, int parallelism) {
    throw new UnsupportedOperationException(
        this.getClass().getName() + " does not support writeManifestsWith");
  }

  /**
   * Perform operations on a particular branch
   *
   * @param branch which is name of SnapshotRef of type branch.
   * @return this for method chaining
   */
  default ThisT toBranch(String branch) {
    throw new UnsupportedOperationException(
        String.format(
            "Cannot commit to branch %s: %s does not support branch commits",
            branch, this.getClass().getName()));
  }

  default ThisT validateWith(SnapshotAncestryValidator validator) {
    throw new UnsupportedOperationException(
        "Snapshot validation not supported by " + this.getClass().getName());
  }
}

View on GitHub (pinned to 86d9c8fc54)