{"record":{"id":"29d644c6f9f5de6a","repo":"apache/iceberg","slug":"updating-a-view-s-location-is-not-supported","errorCode":null,"errorMessage":"Updating a view's location is not supported","messagePattern":"Updating a view's location is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/view/View.java","lineNumber":113,"sourceCode":"   */\n  UpdateViewProperties updateProperties();\n\n  /**\n   * Create a new {@link ReplaceViewVersion} to replace the view's current version.\n   *\n   * @return a new {@link ReplaceViewVersion}\n   */\n  default ReplaceViewVersion replaceVersion() {\n    throw new UnsupportedOperationException(\"Replacing a view's version is not supported\");\n  }\n\n  /**\n   * Create a new {@link UpdateLocation} to set the view's location.\n   *\n   * @return a new {@link UpdateLocation}\n   */\n  default UpdateLocation updateLocation() {\n    throw new UnsupportedOperationException(\"Updating a view's location is not supported\");\n  }\n\n  /**\n   * Returns the view's UUID\n   *\n   * @return the view's UUID\n   */\n  default UUID uuid() {\n    throw new UnsupportedOperationException(\"Retrieving a view's uuid is not supported\");\n  }\n\n  /**\n   * Returns the view representation for the given SQL dialect\n   *\n   * @return the view representation for the given SQL dialect, or null if no representation could\n   *     be resolved\n   */\n  default SQLViewRepresentation sqlFor(String dialect) {","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/view/View.java#L95-L131","documentation":"View.updateLocation() is a default interface method that throws UnsupportedOperationException. It exists so implementations can opt in to supporting location updates; the default signals the operation is not available on the loaded View instance.","triggerScenarios":"Calling view.updateLocation().setLocation(newLocation).commit() on a View whose class does not override updateLocation().","commonSituations":"Relocating/migrating a view's storage location through the catalog API with a minimal View implementation; test doubles that stub the View interface.","solutions":["Ensure the view implementation overrides updateLocation() (BaseView-backed implementations do).","Update the location via the underlying catalog's view metadata update APIs instead.","Guard with an instanceof/capability check before invoking updateLocation()."],"exampleFix":"// before\nview.updateLocation().setLocation(newLocation).commit();\n\n// after\nif (view instanceof BaseView) {\n  view.updateLocation().setLocation(newLocation).commit();\n} else {\n  throw new IllegalArgumentException(\"This catalog does not support view location updates\");\n}","handlingStrategy":"type-guard","validationCode":"boolean canUpdateLocation = view instanceof BaseView;","typeGuard":"static boolean supportsLocationUpdate(View v) { return v instanceof BaseView; }","tryCatchPattern":"try { view.updateLocation().setLocation(loc).commit(); } catch (UnsupportedOperationException e) { /* route through catalog APIs */ }","preventionTips":["Check implementation capabilities before location updates","Use catalog-level relocation workflows instead of ad-hoc updates"],"tags":["java","iceberg","view","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}