{"record":{"id":"f32dc9f01e0437e8","repo":"apache/iceberg","slug":"string-format-cannot-commit-to-branch-s-s-does","errorCode":null,"errorMessage":"String.format(\"Cannot commit to branch %s: %s does not support branch commits\", branch, this.getClass().getName())","messagePattern":"String\\.format\\(\"Cannot commit to branch (.+?): (.+?) does not support branch commits\", branch, this\\.getClass\\(\\)\\.getName\\(\\)\\)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/SnapshotUpdate.java","lineNumber":86,"sourceCode":"   * number of manifest files produced. The executor provides the threads for parallel execution.\n   *\n   * @param executorService the provided executor\n   * @param parallelism the number of parallel manifest writers to use\n   * @return this for method chaining\n   */\n  default ThisT writeManifestsWith(ExecutorService executorService, int parallelism) {\n    throw new UnsupportedOperationException(\n        this.getClass().getName() + \" does not support writeManifestsWith\");\n  }\n\n  /**\n   * Perform operations on a particular branch\n   *\n   * @param branch which is name of SnapshotRef of type branch.\n   * @return this for method chaining\n   */\n  default ThisT toBranch(String branch) {\n    throw new UnsupportedOperationException(\n        String.format(\n            \"Cannot commit to branch %s: %s does not support branch commits\",\n            branch, this.getClass().getName()));\n  }\n\n  default ThisT validateWith(SnapshotAncestryValidator validator) {\n    throw new UnsupportedOperationException(\n        \"Snapshot validation not supported by \" + this.getClass().getName());\n  }\n}\n","sourceCodeStart":68,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/SnapshotUpdate.java#L68-L97","documentation":"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.","triggerScenarios":"Thrown at api/src/main/java/org/apache/iceberg/SnapshotUpdate.java:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Commit to the table's main branch and use manageSnapshots/refs to move a branch afterward","Catch UnsupportedOperationException and surface that branch commits are unsupported for this operation","Use an operation implementation that overrides toBranch"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}