apache/iceberg · error · UnsupportedOperationException

Updating a view's location is not supported

Error message

Updating a view's location is not supported

What it means

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.

Source

Thrown at api/src/main/java/org/apache/iceberg/view/View.java:113

   */
  UpdateViewProperties updateProperties();

  /**
   * Create a new {@link ReplaceViewVersion} to replace the view's current version.
   *
   * @return a new {@link ReplaceViewVersion}
   */
  default ReplaceViewVersion replaceVersion() {
    throw new UnsupportedOperationException("Replacing a view's version is not supported");
  }

  /**
   * Create a new {@link UpdateLocation} to set the view's location.
   *
   * @return a new {@link UpdateLocation}
   */
  default UpdateLocation updateLocation() {
    throw new UnsupportedOperationException("Updating a view's location is not supported");
  }

  /**
   * Returns the view's UUID
   *
   * @return the view's UUID
   */
  default UUID uuid() {
    throw new UnsupportedOperationException("Retrieving a view's uuid is not supported");
  }

  /**
   * Returns the view representation for the given SQL dialect
   *
   * @return the view representation for the given SQL dialect, or null if no representation could
   *     be resolved
   */
  default SQLViewRepresentation sqlFor(String dialect) {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Ensure the view implementation overrides updateLocation() (BaseView-backed implementations do).
  2. Update the location via the underlying catalog's view metadata update APIs instead.
  3. Guard with an instanceof/capability check before invoking updateLocation().

Example fix

// before
view.updateLocation().setLocation(newLocation).commit();

// after
if (view instanceof BaseView) {
  view.updateLocation().setLocation(newLocation).commit();
} else {
  throw new IllegalArgumentException("This catalog does not support view location updates");
}
Defensive patterns

Strategy: type-guard

Validate before calling

boolean canUpdateLocation = view instanceof BaseView;

Type guard

static boolean supportsLocationUpdate(View v) { return v instanceof BaseView; }

Try / catch

try { view.updateLocation().setLocation(loc).commit(); } catch (UnsupportedOperationException e) { /* route through catalog APIs */ }

Prevention

When it happens

Trigger: Calling view.updateLocation().setLocation(newLocation).commit() on a View whose class does not override updateLocation().

Common situations: Relocating/migrating a view's storage location through the catalog API with a minimal View implementation; test doubles that stub the View interface.

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/29d644c6f9f5de6a. Report an issue: GitHub.