{"record":{"id":"5de9d2d45dded59a","repo":"apache/iceberg","slug":"failed-to-get-view-info-from-metastore-s-s","errorCode":null,"errorMessage":"Failed to get view info from metastore %s.%s","messagePattern":"Failed to get view info from metastore (.+?)\\.(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java","lineNumber":109,"sourceCode":"    try {\n      table = metaClients.run(client -> client.getTable(database, viewName));\n\n      // Check if we are trying to load an Iceberg Table as a View\n      HiveOperationsBase.validateIcebergTableNotLoadedAsIcebergView(table, fullName);\n      // Check if it is a valid Iceberg View\n      HiveOperationsBase.validateTableIsIcebergView(table, fullName);\n\n      metadataLocation =\n          table.getParameters().get(BaseMetastoreTableOperations.METADATA_LOCATION_PROP);\n\n    } catch (NoSuchObjectException e) {\n      if (currentMetadataLocation() != null) {\n        throw new NoSuchViewException(\"View does not exist: %s.%s\", database, viewName);\n      }\n    } catch (TException e) {\n      String errMsg =\n          String.format(\"Failed to get view info from metastore %s.%s\", database, viewName);\n      throw new RuntimeException(errMsg, e);\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\"Interrupted during refresh\", e);\n    }\n\n    refreshFromMetadataLocation(metadataLocation);\n  }\n\n  @SuppressWarnings(\"checkstyle:CyclomaticComplexity\")\n  @Override\n  public void doCommit(ViewMetadata base, ViewMetadata metadata) {\n    boolean newView = base == null;\n    String newMetadataLocation = writeNewMetadataIfRequired(metadata);\n    boolean hiveEngineEnabled = false;\n\n    CommitStatus commitStatus = CommitStatus.FAILURE;\n    boolean updateHiveView = false;\n","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java#L91-L127","documentation":"HiveViewOperations.doRefresh throws a RuntimeException (wrapping the original Thrift exception) when the Hive metastore call to fetch view info fails with a generic TException. This indicates a metastore communication or server-side failure rather than a missing object, so it is surfaced with the database/view name and the cause chained.","triggerScenarios":"Any refresh of a Hive view where hive.getView (or equivalent metastore RPC) throws TException — e.g., metastore connectivity failures, HMS server errors, thrift protocol issues.","commonSituations":"Hive metastore down or restarting; network partitions between client and HMS; thrift version/protocol mismatch; HMS timeouts under load; misconfigured metastore URIs.","solutions":["Check HMS availability and logs; restart or fail over the metastore if it is unhealthy.","Verify hive.metastore.uris and network connectivity/firewall rules from the client.","Retry the operation after confirming the metastore is reachable; inspect the chained cause (getCause()) for the underlying Thrift error.","Align hive-metastore client library versions with the server if protocol errors appear."],"exampleFix":"// before: no handling of transient metastore failures\nview.refresh();\n// after\ntry {\n  view.refresh();\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof TException) { /* retry or fail over */ }\n  throw e;\n}","handlingStrategy":"retry","validationCode":"// Pre-check metastore reachability\n// e.g., ping HMS or validate hive.metastore.uris configuration before bulk operations\n","typeGuard":null,"tryCatchPattern":"try {\n  view.refresh();\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof TException) {\n    // retry with backoff after checking HMS health\n  } else { throw e; }\n}","preventionTips":["Monitor Hive metastore health and failover before running jobs.","Verify hive.metastore.uris and network/firewall connectivity.","Use bounded retries with exponential backoff for refresh operations.","Keep HMS client library versions aligned with the server."],"tags":["hive-metastore","thrift","network","view"],"backgroundTag":"database-query-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"}