{"record":{"id":"e778c4e6139f6777","repo":"apache/iceberg","slug":"failed-to-list-all-views-under-namespace-namespa","errorCode":null,"errorMessage":"Failed to list all views under namespace ${namespace}","messagePattern":"Failed to list all views under namespace (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java","lineNumber":229,"sourceCode":"      String database = namespace.level(0);\n      List<String> viewNames =\n          clients.run(client -> client.getTables(database, \"*\", TableType.VIRTUAL_VIEW));\n\n      // Retrieving the Table objects from HMS in batches to avoid OOM\n      List<TableIdentifier> filteredTableIdentifiers = Lists.newArrayList();\n      Iterable<List<String>> viewNameSets = Iterables.partition(viewNames, 100);\n\n      for (List<String> viewNameSet : viewNameSets) {\n        filteredTableIdentifiers.addAll(\n            listIcebergTables(viewNameSet, namespace, HiveOperationsBase.ICEBERG_VIEW_TYPE_VALUE));\n      }\n\n      return filteredTableIdentifiers;\n    } catch (UnknownDBException e) {\n      throw new NoSuchNamespaceException(\"Namespace does not exist: %s\", namespace);\n\n    } catch (TException e) {\n      throw new RuntimeException(\"Failed to list all views under namespace \" + namespace, e);\n\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\"Interrupted in call to listViews\", e);\n    }\n  }\n\n  @Override\n  public String name() {\n    return name;\n  }\n\n  @Override\n  public boolean dropTable(TableIdentifier identifier, boolean purge) {\n    if (!isValidIdentifier(identifier)) {\n      return false;\n    }\n","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L211-L247","documentation":"listViews() wraps a Thrift TException from the Hive Metastore in a RuntimeException with this message when listing views fails at the RPC/protocol level. It indicates a metastore communication or server-side failure rather than a missing namespace.","triggerScenarios":"Calling catalog.listViews(namespace) and the Hive Metastore throws a TException — e.g. metastore connection dropped, Thrift protocol mismatch, or metastore-side error while fetching table list filtered by ICEBERG_VIEW_TYPE_VALUE.","commonSituations":"Metastore is down or restarting; network partition/firewall between client and metastore; incompatible Hive client/library versions speaking different Thrift protocols; metastore timeout under load.","solutions":["Check metastore availability and connectivity (metastore URI, ping the service).","Inspect the chained cause (e.getCause()) for the concrete TException detail.","Align Hive/metastore client versions with the server's Thrift protocol.","Retry with backoff; transient metastore hiccups commonly produce this."],"exampleFix":"// before\nList<ViewIdentifier> views = catalog.listViews(ns);\n// after\ntry {\n  List<ViewIdentifier> views = catalog.listViews(ns);\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof TException) {\n    LOG.warn(\"Metastore RPC failed listing views in {}\", ns, e);\n    // retry or fail over\n  }\n}","handlingStrategy":"retry","validationCode":"// No local check can detect a metastore RPC failure in advance; verify connectivity out of band:\n// metastore URI reachable, e.g. nc -z <host> <port>","typeGuard":null,"tryCatchPattern":"try {\n  views = catalog.listViews(ns);\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof TException) {\n    // retry with exponential backoff, bounded attempts\n  }\n  throw e;\n}","preventionTips":["Monitor metastore health and add retries with backoff for Thrift calls.","Keep Hive client versions aligned with the metastore server.","Set explicit timeouts on the metastore connection so hangs fail fast."],"tags":["hive-metastore","thrift","rpc","views"],"backgroundTag":"metastore-rpc-failed","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"}