{"record":{"id":"b9b1fb72c42e24e7","repo":"apache/iceberg","slug":"retrieving-a-view-s-uuid-is-not-supported","errorCode":null,"errorMessage":"Retrieving a view's uuid is not supported","messagePattern":"Retrieving a view's uuid is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/view/View.java","lineNumber":122,"sourceCode":"    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) {\n    throw new UnsupportedOperationException(\n        \"Resolving a sql with a given dialect is not supported\");\n  }\n}\n","sourceCodeStart":104,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/view/View.java#L104-L136","documentation":"View.uuid() is a default interface method that throws UnsupportedOperationException. Implementations that carry view metadata (BaseView) return the view's UUID; minimal implementations do not and surface this error instead.","triggerScenarios":"Calling view.uuid() after completeCreateView or loadView on a View implementation that does not override uuid().","commonSituations":"Extracting a stable view identifier for lineage/audit code against a custom or stub View; catalogs returning lightweight View adapters.","solutions":["Use a metadata-backed View implementation (e.g. BaseView) that overrides uuid().","Obtain the UUID from the underlying ViewMetadata directly instead of the interface.","Use another stable identifier (the view's name/location) when UUID is unavailable."],"exampleFix":"// before\nUUID id = view.uuid();\n\n// after\nUUID id = (view instanceof BaseView)\n    ? view.uuid()\n    : null; // fall back to catalog-supplied identifier","handlingStrategy":"try-catch","validationCode":"boolean hasUuid = view instanceof BaseView;","typeGuard":"static boolean hasUuid(View v) { return v instanceof BaseView; }","tryCatchPattern":"try { return view.uuid(); } catch (UnsupportedOperationException e) { return null; }","preventionTips":["Treat uuid() as optional metadata; always null-check or fall back","Use view name/location as a stable identifier when UUID is unavailable"],"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"}