apache/iceberg · error · UnsupportedOperationException

doesn't support initialization

Error message

 doesn't support initialization

What it means

BaseViewSessionCatalog's wrapped ViewSessionCatalog context object does not support the initialize lifecycle method; calling initialize on it throws UnsupportedOperationException with the class name. Initialization is meant for the underlying catalog, not this session-catalog adapter.

Solutions

  1. Call initialize on the underlying catalog implementation, not the session-catalog view wrapper
  2. Initialize the BaseViewSessionCatalog itself before obtaining view contexts
  3. Guard with a capability check before calling initialize on unknown catalog types

Example fix

// before
viewSessionCatalog.initialize(name, props);
// after
baseViewSessionCatalog.asCatalog().initialize(name, props); // init the real catalog
Defensive patterns

Strategy: type-guard

Validate before calling

if (catalog instanceof BaseViewSessionCatalog.ViewSessionCatalog) { /* adapter does not support initialize */ }

Type guard

boolean supportsInitialize(Catalog c) { return !(c instanceof BaseViewSessionCatalog.ViewSessionCatalog); }

Try / catch

try { viewCtx.initialize(name, props); } catch (UnsupportedOperationException e) { /* initialize the underlying catalog instead */ }

Prevention

When it happens

Trigger: Calling initialize(name, properties) on a BaseViewSessionCatalog view-context wrapper obtained via asViewCatalog or similar adapter.

Common situations: Framework code (e.g. engine catalog initialization hooks) uniformly calling initialize on any catalog object without checking adapter support.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/cd2a3b5698b8d13a. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/catalog/BaseViewSessionCatalog.java:93

    @Override
    public void renameView(TableIdentifier from, TableIdentifier to) {
      BaseViewSessionCatalog.this.renameView(context, from, to);
    }

    @Override
    public void invalidateView(TableIdentifier identifier) {
      BaseViewSessionCatalog.this.invalidateView(context, identifier);
    }

    @Override
    public View registerView(TableIdentifier identifier, String metadataFileLocation) {
      return BaseViewSessionCatalog.this.registerView(context, identifier, metadataFileLocation);
    }

    @Override
    public void initialize(String name, Map<String, String> properties) {
      throw new UnsupportedOperationException(
          this.getClass().getSimpleName() + " doesn't support initialization");
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)