apache/iceberg · error · NoSuchViewException

Invalid view identifier: %s

Error message

Invalid view identifier: %s

What it means

A NoSuchViewException thrown by RESTSessionCatalog.checkViewIdentifierIsValid when a view identifier's namespace is empty. Like tables, REST catalog views require a non-empty namespace; an identifier without one is rejected before any server call.

Source

Thrown at core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:1412

            .get(
                ResourcePaths.config(),
                queryParams.build(),
                ConfigResponse.class,
                RESTUtil.configHeaders(properties),
                ErrorHandlers.configErrorHandler());
    configResponse.validate();
    return configResponse;
  }

  private void checkIdentifierIsValid(TableIdentifier tableIdentifier) {
    if (tableIdentifier.namespace().isEmpty()) {
      throw new NoSuchTableException("Invalid table identifier: %s", tableIdentifier);
    }
  }

  private void checkViewIdentifierIsValid(TableIdentifier identifier) {
    if (identifier.namespace().isEmpty()) {
      throw new NoSuchViewException("Invalid view identifier: %s", identifier);
    }
  }

  private void checkNamespaceIsValid(Namespace namespace) {
    if (namespace.isEmpty()) {
      throw new NoSuchNamespaceException("Invalid namespace: %s", namespace);
    }
  }

  public void commitTransaction(SessionContext context, List<TableCommit> commits) {
    Endpoint.check(endpoints, Endpoint.V1_COMMIT_TRANSACTION);
    List<UpdateTableRequest> tableChanges = Lists.newArrayListWithCapacity(commits.size());

    for (TableCommit commit : commits) {
      tableChanges.add(
          UpdateTableRequest.create(commit.identifier(), commit.requirements(), commit.updates()));
    }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Qualify the view with a namespace: TableIdentifier.of(Namespace.of("reporting"), "daily_metrics").
  2. Resolve unqualified names against the configured default namespace before calling view APIs.
  3. Guard with identifier.namespace().isEmpty() prior to the call.
  4. Catch NoSuchViewException when invalid identifiers should be treated as 'view absent'.

Example fix

// before
View view = catalog.loadView(TableIdentifier.of(Namespace.of(), "v"));
// after
View view = catalog.loadView(TableIdentifier.of(Namespace.of("analytics"), "v"));
Defensive patterns

Strategy: validation

Validate before calling

if (identifier == null || identifier.namespace().isEmpty()) { throw new IllegalArgumentException("view identifier requires a non-empty namespace: " + identifier); }

Try / catch

try { catalog.loadView(ident); } catch (NoSuchViewException e) { /* invalid or missing view identifier */ }

Prevention

When it happens

Trigger: Calling view APIs (loadView, viewExists, dropView, buildView/replaceTransaction) with a TableIdentifier whose Namespace is empty.

Common situations: Same as tables: unqualified view names from user input or SQL that skipped default-namespace resolution; programmatic identifier construction with Namespace.of().

Related errors


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