{"record":{"id":"889603460e6d6d65","repo":"apache/iceberg","slug":"cannot-find-glue-table-s-after-refresh-maybe-ano","errorCode":null,"errorMessage":"Cannot find Glue table %s after refresh, maybe another process deleted it or revoked your access permission","messagePattern":"Cannot find Glue table (.+?) after refresh, maybe another process deleted it or revoked your access permission","errorType":"exception","errorClass":"NoSuchTableException","httpStatus":null,"severity":"error","filePath":"aws/src/main/java/org/apache/iceberg/aws/glue/GlueTableOperations.java","lineNumber":134,"sourceCode":"    }\n    return fileIO;\n  }\n\n  @Override\n  protected String tableName() {\n    return fullTableName;\n  }\n\n  @Override\n  protected void doRefresh() {\n    String metadataLocation = null;\n    Table table = getGlueTable();\n    if (table != null) {\n      checkIfTableIsIceberg(table, tableName());\n      metadataLocation = table.parameters().get(METADATA_LOCATION_PROP);\n    } else {\n      if (currentMetadataLocation() != null) {\n        throw new NoSuchTableException(\n            \"Cannot find Glue table %s after refresh, \"\n                + \"maybe another process deleted it or revoked your access permission\",\n            tableName());\n      }\n    }\n\n    refreshFromMetadataLocation(metadataLocation);\n  }\n\n  @Override\n  protected void doCommit(TableMetadata base, TableMetadata metadata) {\n    CommitStatus commitStatus = CommitStatus.FAILURE;\n    RetryDetector retryDetector = new RetryDetector();\n\n    String newMetadataLocation = null;\n    boolean glueTempTableCreated = false;\n    try {\n      glueTempTableCreated = createGlueTempTableIfNecessary(base, metadata.location());","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/aws/src/main/java/org/apache/iceberg/aws/glue/GlueTableOperations.java#L116-L152","documentation":"GlueTableOperations.doRefresh throws NoSuchTableException when a refresh finds the Glue table missing (getGlueTable returns null) even though the operation previously knew a metadata location. This indicates the table was deleted underneath the running operation or access was revoked, so the current state cannot be refreshed.","triggerScenarios":"Calling table.refresh() or any operation triggering refresh (reads, commits) after another process/job issued Glue DeleteTable, or after IAM permissions on the table were revoked mid-session.","commonSituations":"Concurrent Spark/Flink jobs where one drops the table while another holds an open reference; retention jobs cleaning up 'old' tables still in use; Lake Formation permission changes removing access; long-running streaming queries whose underlying table was deleted.","solutions":["Check whether another job or user dropped the Glue table (CloudTrail for DeleteTable events) and stop the drop or recreate the table.","Verify Lake Formation / IAM grants still allow the current role to read the table.","Recreate the table from its metadata if the deletion was accidental, then re-open the Iceberg table reference.","Coordinate table lifecycle across pipelines — never drop tables while readers hold live references."],"exampleFix":"// before\nTable table = catalog.loadTable(ident);\ntable.refresh(); // throws if table was deleted concurrently\n\n// after\nTable table = catalog.loadTable(ident);\nif (!catalog.tableExists(ident)) {\n  LOG.error(\"Table {} was deleted externally, aborting job\", ident);\n  return;\n}\ntable.refresh();","handlingStrategy":"try-catch","validationCode":"TableIdentifier ident = TableIdentifier.of(\"sales\", \"events\");\nif (!catalog.tableExists(ident)) {\n  throw new IllegalStateException(\"Table \" + ident + \" no longer exists in Glue\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  table.refresh();\n} catch (NoSuchTableException e) {\n  LOG.error(\"Glue table {} was deleted or access revoked mid-job; aborting\", tableName);\n  throw e;\n}","preventionTips":["Never drop Glue tables while other jobs may hold open references","Use CloudTrail alerts on DeleteTable for production databases","Review Lake Formation/IAM grants before revoking table access","Restart long-running streaming jobs after table recreation to pick up fresh references"],"tags":["aws","glue","table","deleted","concurrency","refresh"],"backgroundTag":"entity-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"}