{"record":{"id":"cd02445a81959872","repo":"apache/iceberg","slug":"failed-to-load-table-s-from-catalog-s-dropped-b","errorCode":null,"errorMessage":"Failed to load table %s from catalog %s: dropped by another process","messagePattern":"Failed to load table (.+?) from catalog (.+?): dropped by another process","errorType":"exception","errorClass":"NoSuchTableException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/jdbc/JdbcTableOperations.java","lineNumber":85,"sourceCode":"\n  @Override\n  public void doRefresh() {\n    Map<String, String> table;\n\n    try {\n      table = JdbcUtil.loadTable(schemaVersion, connections, catalogName, tableIdentifier);\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new UncheckedInterruptedException(e, \"Interrupted during refresh\");\n    } catch (SQLException e) {\n      // SQL exception happened when getting table from catalog\n      throw new UncheckedSQLException(\n          e, \"Failed to get table %s from catalog %s\", tableIdentifier, catalogName);\n    }\n\n    if (table.isEmpty()) {\n      if (currentMetadataLocation() != null) {\n        throw new NoSuchTableException(\n            \"Failed to load table %s from catalog %s: dropped by another process\",\n            tableIdentifier, catalogName);\n      } else {\n        this.disableRefresh();\n        return;\n      }\n    }\n\n    String newMetadataLocation = table.get(METADATA_LOCATION_PROP);\n    Preconditions.checkState(\n        newMetadataLocation != null,\n        \"Invalid table %s: metadata location is null\",\n        tableIdentifier);\n    refreshFromMetadataLocation(newMetadataLocation);\n  }\n\n  @Override\n  public void doCommit(TableMetadata base, TableMetadata metadata) {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/jdbc/JdbcTableOperations.java#L67-L103","documentation":"A NoSuchTableException signalling the table's metadata row disappeared from the JDBC catalog between operations. doRefresh() found an empty result but a metadata location was previously cached, meaning the table was deleted by another process. This prevents operations against a stale table reference.","triggerScenarios":"doRefresh() calls JdbcUtil.loadTable and gets an empty map while currentMetadataLocation() != null — i.e., the cached table was dropped externally.","commonSituations":"Two jobs/processes sharing a catalog where one drops the table the other is still writing to, manual DELETE from the catalog DB, DROP TABLE issued concurrently with commits.","solutions":["Re-open the table via the catalog instead of continuing with the stale reference.","Coordinate table lifecycle across processes (don't drop tables under active writers).","Use catalog-level DROP TABLE rather than deleting catalog rows manually.","Add application logic to catch NoSuchTableException and handle table recreation."],"exampleFix":"// before\nTable table = catalog.loadTable(identifier);\ntable.refresh(); // may throw if dropped elsewhere\n// after\ntry {\n  table.refresh();\n} catch (NoSuchTableException e) {\n  table = catalog.loadTable(identifier); // reload or handle missing table\n}","handlingStrategy":"try-catch","validationCode":"// check the table still exists before committing\nif (!catalog.tableExists(identifier)) {\n  throw new IllegalStateException(\"Table \" + identifier + \" no longer exists in catalog\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  table.refresh();\n} catch (org.apache.iceberg.exceptions.NoSuchTableException e) {\n  // table dropped by another process: stop writes, reload or recreate\n  table = catalog.tableExists(identifier) ? catalog.loadTable(identifier) : null;\n}","preventionTips":["Never drop tables while other processes hold active references.","Use catalog DROP TABLE, never manual DELETE on catalog rows.","Coordinate table lifecycle with job scheduling/locks."],"tags":["jdbc","concurrency","table-not-found"],"backgroundTag":"record-not-found","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"}