apache/iceberg · error · RuntimeException

Failed to check view existence of ${viewIdentifier}

Error message

Failed to check view existence of ${viewIdentifier}

What it means

A RuntimeException wrapping a Thrift TException raised while HiveCatalog.viewExists probes the metastore for a view. Not-found outcomes (NoSuchIcebergViewException/NoSuchObjectException) return false normally; any other Thrift failure is unexpected and wrapped with this message and the original cause.

Source

Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:520

    }
  }

  @Override
  public boolean viewExists(TableIdentifier viewIdentifier) {
    if (!isValidIdentifier(viewIdentifier)) {
      return false;
    }

    String database = viewIdentifier.namespace().level(0);
    String viewName = viewIdentifier.name();
    try {
      Table table = clients.run(client -> client.getTable(database, viewName));
      HiveOperationsBase.validateTableIsIcebergView(table, fullTableName(name, viewIdentifier));
      return true;
    } catch (NoSuchIcebergViewException | NoSuchObjectException e) {
      return false;
    } catch (TException e) {
      throw new RuntimeException("Failed to check view existence of " + viewIdentifier, e);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new RuntimeException(
          "Interrupted in call to check view existence of " + viewIdentifier, e);
    }
  }

  @Override
  public void createNamespace(Namespace namespace, Map<String, String> meta) {
    Preconditions.checkArgument(
        !namespace.isEmpty(), "Cannot create namespace with invalid name: %s", namespace);
    Preconditions.checkArgument(
        isValidateNamespace(namespace),
        "Cannot support multi part namespace in Hive Metastore: %s",
        namespace);
    Preconditions.checkArgument(
        meta.get(HMS_DB_OWNER_TYPE) == null || meta.get(HMS_DB_OWNER) != null,
        "Create namespace setting %s without setting %s is not allowed",

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check the cause chain for the underlying Thrift error to distinguish connectivity from server-side failure.
  2. Verify metastore health, URIs, and authentication credentials, then retry.
  3. Batch or cache view-existence checks in engines that probe many views at planning time.

Example fix

// before
boolean exists = catalog.viewExists(viewId);
// after
try {
  boolean exists = catalog.viewExists(viewId);
} catch (RuntimeException e) {
  LOG.error("Metastore failure checking view {}", viewId, e.getCause());
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check metastore reachability before view resolution

Try / catch

try { boolean ok = catalog.viewExists(viewId); } catch (RuntimeException e) { /* unknown state; inspect e.getCause() */ }

Prevention

When it happens

Trigger: Calling viewExists(identifier) (or code paths that rely on it) when clients.run(client -> client.getTable(database, viewName)) fails with a TException other than not-found — metastore connectivity failure, server error, or protocol issue.

Common situations: Metastore outage during query planning; wrong metastore configuration; Kerberos/token expiry causing transport failures; metastore overload.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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