{"record":{"id":"df6953b3b3df4ca4","repo":"apache/iceberg","slug":"failed-to-get-table-info-from-metastore-database","errorCode":null,"errorMessage":"Failed to get table info from metastore <database>.<tableName>","messagePattern":"Failed to get table info from metastore <database>\\.<tableName>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java","lineNumber":199,"sourceCode":"      HiveOperationsBase.validateTableIsIceberg(table, fullName);\n\n      metadataLocation = table.getParameters().get(METADATA_LOCATION_PROP);\n      /* Table key ID must be retrieved from a catalog service, and not from untrusted storage\n      (e.g. metadata json file) that can be tampered with. For example, an attacker can remove\n      the table key parameter (along with existing snapshots) in the file, making the writers\n      produce unencrypted files. Table key ID is taken directly from HMS catalog */\n      tableKeyIdFromHMS = table.getParameters().get(TableProperties.ENCRYPTION_TABLE_KEY);\n      dekLengthFromHMS = table.getParameters().get(TableProperties.ENCRYPTION_DEK_LENGTH);\n      metadataHashFromHMS = table.getParameters().get(METADATA_HASH_PROP);\n    } catch (NoSuchObjectException e) {\n      if (currentMetadataLocation() != null) {\n        throw new NoSuchTableException(\"No such table: %s.%s\", database, tableName);\n      }\n\n    } catch (TException e) {\n      String errMsg =\n          String.format(\"Failed to get table info from metastore %s.%s\", database, tableName);\n      throw new RuntimeException(errMsg, e);\n\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\"Interrupted during refresh\", e);\n    }\n\n    refreshFromMetadataLocation(metadataLocation, metadataRefreshMaxRetries);\n\n    if (tableKeyIdFromHMS != null) {\n      checkIntegrityForEncryption(tableKeyIdFromHMS, dekLengthFromHMS, metadataHashFromHMS);\n\n      tableKeyId = tableKeyIdFromHMS;\n      encryptionDekLength =\n          (dekLengthFromHMS != null)\n              ? Integer.parseInt(dekLengthFromHMS)\n              : TableProperties.ENCRYPTION_DEK_LENGTH_DEFAULT;\n\n      encryptedKeys =","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java#L181-L217","documentation":"HiveTableOperations.doRefresh wraps any TException from the Hive metastore get_table call into a RuntimeException 'Failed to get table info from metastore <db>.<table>' with the original cause attached. It indicates a metastore communication or thrift failure rather than a missing table.","triggerScenarios":"Thrift connectivity failures, metastore timeouts, serialization errors, or metastore-side exceptions thrown during the get_table call inside doRefresh.","commonSituations":"Hive metastore down or restarting; network/security-group issues between the job and the metastore; Kerberos/thrift version mismatches; metastore overload.","solutions":["Check the wrapped cause (e) and verify Hive metastore connectivity (host, port, hive.metastore.uris).","Confirm the metastore service is healthy and reachable (telnet/nc the metastore URI, check metastore logs).","Verify Thrift/Kerberos configuration and client-metastore version compatibility; retry transient failures."],"exampleFix":"// before\nconf.set(\"hive.metastore.uris\", \"thrift://old-host:9083\");\n// after\nconf.set(\"hive.metastore.uris\", \"thrift://metastore.example.com:9083\"); // reachable, matching version","handlingStrategy":"retry","validationCode":"// before running: verify metastore reachability\nnew Socket(metastoreHost, metastorePort).close();","typeGuard":null,"tryCatchPattern":"try { table.refresh(); } catch (RuntimeException e) { if (e.getCause() instanceof TException) { /* retry with backoff or alert on metastore health */ } }","preventionTips":["Monitor Hive metastore health and connectivity from job hosts.","Configure metastore client timeouts and retries.","Keep thrift/Kerberos configuration consistent across the cluster."],"tags":["hive-metastore","thrift","connectivity"],"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-23T08:17:48.524Z"}