{"record":{"id":"7992a32309f72e7e","repo":"apache/iceberg","slug":"setting-a-view-s-location-is-not-supported","errorCode":null,"errorMessage":"Setting a view's location is not supported","messagePattern":"Setting a view's location is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/view/ViewBuilder.java","lineNumber":55,"sourceCode":"  ViewBuilder withProperties(Map<String, String> properties);\n\n  /**\n   * Add a key/value property to the view.\n   *\n   * @param key a key\n   * @param value a value\n   * @return this for method chaining\n   */\n  ViewBuilder withProperty(String key, String value);\n\n  /**\n   * Sets a location for the view\n   *\n   * @param location the location to set for the view\n   * @return this for method chaining\n   */\n  default ViewBuilder withLocation(String location) {\n    throw new UnsupportedOperationException(\"Setting a view's location is not supported\");\n  }\n\n  /**\n   * Create the view.\n   *\n   * @return the view created\n   */\n  View create();\n\n  /**\n   * Replace the view.\n   *\n   * @return the {@link View} replaced\n   */\n  View replace();\n\n  /**\n   * Create or replace the view.","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/view/ViewBuilder.java#L37-L73","documentation":"ViewBuilder.withLocation(String) is a default interface method that throws UnsupportedOperationException. The builder default signals that setting an explicit view location is optional to implement; view builders without location support throw this error.","triggerScenarios":"Calling catalog.buildView(...).withLocation(location) during view creation with a ViewBuilder implementation that does not override withLocation().","commonSituations":"Creating views with a custom storage location in catalogs whose builder derives the location automatically; test stubs of ViewBuilder.","solutions":["Omit withLocation() and let the catalog choose the view's default location.","Use a catalog implementation whose ViewBuilder supports explicit locations.","Set the location through catalog configuration (warehouse/base location properties) instead."],"exampleFix":"// before\nbuilder.withLocation(\"s3://bucket/views/v1\").create();\n\n// after\nViewBuilder b = builder; // catalog derives location if unsupported\nView v = b.withSchema(schema)... .create();","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { builder.withLocation(loc); } catch (UnsupportedOperationException e) { /* omit withLocation, accept catalog default */ }","preventionTips":["Only call withLocation when the catalog documents location customization","Configure a warehouse/base location at the catalog level instead"],"tags":["java","iceberg","view-builder","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-23T08:17:48.524Z"}