{"record":{"id":"758d10cd4717eb86","repo":"apache/iceberg","slug":"requirement-failed-view-uuid-does-not-match-expe","errorCode":null,"errorMessage":"Requirement failed: view UUID does not match: expected %s != %s","messagePattern":"Requirement failed: view UUID does not match: expected (.+?) != (.+?)","errorType":"exception","errorClass":"CommitFailedException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/UpdateRequirement.java","lineNumber":85,"sourceCode":"    }\n  }\n\n  class AssertViewUUID implements UpdateRequirement {\n    private final String uuid;\n\n    public AssertViewUUID(String uuid) {\n      Preconditions.checkArgument(uuid != null, \"Invalid required UUID: null\");\n      this.uuid = uuid;\n    }\n\n    public String uuid() {\n      return uuid;\n    }\n\n    @Override\n    public void validate(ViewMetadata base) {\n      if (!uuid.equalsIgnoreCase(base.uuid())) {\n        throw new CommitFailedException(\n            \"Requirement failed: view UUID does not match: expected %s != %s\", base.uuid(), uuid);\n      }\n    }\n  }\n\n  class AssertRefSnapshotID implements UpdateRequirement {\n    private final String name;\n    private final Long snapshotId;\n\n    public AssertRefSnapshotID(String name, Long snapshotId) {\n      this.name = name;\n      this.snapshotId = snapshotId;\n    }\n\n    public String refName() {\n      return name;\n    }\n","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/UpdateRequirement.java#L67-L103","documentation":"AssertViewUUID is the view counterpart of AssertTableUUID: it asserts the base view metadata still has the UUID the client read. On mismatch, validate throws CommitFailedException with expected and actual UUIDs, protecting view commits from being applied to a recreated view.","triggerScenarios":"Committing view definition updates with an AssertViewUUID requirement while the view was dropped and recreated between the client's read and the commit.","commonSituations":"Concurrent drop/recreate of a view; stale long-lived clients holding an old ViewVersion; environments where views are recreated by deployment scripts.","solutions":["Reload the view (catalog.loadView / refresh) to obtain current metadata and retry with rebuilt requirements.","Detect the drop-and-recreate scenario and reapply changes against the new view UUID.","Catch CommitFailedException, refresh, and re-run the update transaction."],"exampleFix":"// before\nview.updateSchema(...).commit(); // fails after view recreate\n\n// after\ntry {\n  view.updateSchema(...).commit();\n} catch (CommitFailedException e) {\n  View fresh = catalog.loadView(ident); // rebuild update against fresh.uuid()\n}","handlingStrategy":"retry","validationCode":"if (!expectedUuid.equalsIgnoreCase(currentView.uuid())) { /* reload view and rebuild requirements */ }","typeGuard":null,"tryCatchPattern":"try { commit(requirements); } catch (CommitFailedException e) { View fresh = catalog.loadView(ident); /* rebuild requirements with fresh.uuid() and retry */ }","preventionTips":["Reload view metadata before committing after long edit sessions.","Treat UUID mismatch as evidence the view was dropped and recreated.","Keep view update clients short-lived to reduce stale-UUID windows."],"tags":["commit-failed","uuid-mismatch","view"],"backgroundTag":"conflicting-concurrent-update","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"}