{"record":{"id":"e5df3a7825c25349","repo":"apache/iceberg","slug":"no-such-table-s-s","errorCode":null,"errorMessage":"No such table: %s.%s","messagePattern":"No such table: (.+?)\\.(.+?)","errorType":"exception","errorClass":"NoSuchTableException","httpStatus":404,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java","lineNumber":193,"sourceCode":"    try {\n      Table table = metaClients.run(client -> client.getTable(database, tableName));\n\n      // Check if we are trying to load an Iceberg View as a Table\n      HiveOperationsBase.validateIcebergViewNotLoadedAsIcebergTable(table, fullName);\n      // Check if it is a valid Iceberg Table\n      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;","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java#L175-L211","documentation":"HiveTableOperations.doRefresh throws NoSuchTableException when the Hive metastore reports NoSuchObjectException during refresh, but this operations object already holds a metadata location (i.e., the table existed earlier and now vanished). It signals the table was dropped concurrently or between operations.","triggerScenarios":"Refreshing (loadTable → any scan/commit path triggering doRefresh) while another process drops the HMS table; HMS get_table returning NoSuchObjectException with currentMetadataLocation() != null.","commonSituations":"Concurrent drop-and-recreate pipelines; a different job dropping the table mid-read; cluster tools (e.g. drop cascades) removing the table during a long-running job.","solutions":["Re-check the table existence in HMS; recreate it if the drop was unintended.","Retry the catalog operation after confirming the table was recreated (fresh loadTable).","Coordinate drop operations with readers/writers (locks or job orchestration) to avoid concurrent removal."],"exampleFix":"// before\nTable t = catalog.loadTable(ident); ... long job ...; t.refresh(); // table dropped meanwhile -> NoSuchTableException\n// after\nif (catalog.tableExists(ident)) { t = catalog.loadTable(ident); } else { /* recreate or abort */ }","handlingStrategy":"retry","validationCode":"if (!catalog.tableExists(ident)) { throw new NoSuchTableException(\"Table dropped: \" + ident); } // check before long jobs","typeGuard":null,"tryCatchPattern":"try { table.refresh(); } catch (NoSuchTableException e) { if (catalog.tableExists(ident)) { table = catalog.loadTable(ident); table.refresh(); } else { /* recreate or abort */ } }","preventionTips":["Coordinate drops with active readers/writers.","Re-verify existence after long-running stages.","Use drop-and-recreate pipelines that publish atomically."],"tags":["hive-metastore","concurrent-drop","refresh"],"backgroundTag":"resource-not-found","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"}