{"record":{"id":"c21cae4e2a303fea","repo":"prestodb/presto","slug":"table-not-found-c21cae","errorCode":null,"errorMessage":"Table not found","messagePattern":"Table not found","errorType":"exception","errorClass":"TableNotFoundException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java","lineNumber":1756,"sourceCode":"                .map(IcebergColumnHandle.class::cast)\n                .map(IcebergColumnHandle::getId)\n                .collect(toImmutableSet());\n\n        return Objects.equals(enforcedColumnIds, predicateColumnIds);\n    }\n\n    @Override\n    public OptionalLong metadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle)\n    {\n        IcebergTableHandle handle = (IcebergTableHandle) tableHandle;\n        IcebergTableLayoutHandle layoutHandle = (IcebergTableLayoutHandle) tableLayoutHandle;\n\n        Table icebergTable;\n        try {\n            icebergTable = getIcebergTable(session, handle.getSchemaTableName());\n        }\n        catch (Exception e) {\n            throw new TableNotFoundException(handle.getSchemaTableName());\n        }\n\n        TupleDomain<IcebergColumnHandle> domainPredicate = layoutHandle.getValidPredicate();\n        return removeScanFiles(handle, icebergTable, domainPredicate);\n    }\n\n    @Override\n    public void setTableProperties(ConnectorSession session, ConnectorTableHandle tableHandle, Map<String, Object> properties)\n    {\n        IcebergTableHandle handle = (IcebergTableHandle) tableHandle;\n        validateNoBranchSpecified(handle, \"SET TABLE PROPERTIES\");\n        Table icebergTable = getIcebergTable(session, handle.getSchemaTableName());\n\n        UpdateProperties updateProperties = icebergTable.updateProperties();\n        for (Map.Entry<String, Object> entry : properties.entrySet()) {\n            if (!tableProperties.getUpdatableProperties()\n                    .contains(entry.getKey())) {\n                throw new PrestoException(NOT_SUPPORTED, \"Updating property \" + entry.getKey() + \" is not supported currently\");","sourceCodeStart":1738,"sourceCodeEnd":1774,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java#L1738-L1774","documentation":"Throws TableNotFoundException when the underlying Iceberg table can no longer be resolved while applying an index/scan for a table handle. The catalog metadata (table handle) became stale because the table was dropped or renamed between query planning and execution.","triggerScenarios":"Calling removeScanFiles/layout application (IcebergAbstractMetadata:1756) where getIcebergTable(session, handle.getSchemaTableName()) fails because the table was dropped or renamed after the handle was created.","commonSituations":"Long-lived sessions or cached table handles referencing a dropped table; concurrent DROP TABLE while another query reads it; schema-registry or Glue/Hive metastore outages making the table temporarily unresolvable.","solutions":["Re-run the query to get a fresh table handle after the table is restored/recreated.","Check that the table exists in the metastore: SELECT * FROM iceberg.information_schema.tables WHERE ... or SHOW CREATE TABLE.","Avoid dropping/renaming tables while dependent queries are running.","If a metastore outage caused it, verify connectivity and retry once the catalog is available."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Confirm the table resolves before executing dependent logic\nboolean exists = metadata.listTables(session, schemaName).contains(tableName);","typeGuard":null,"tryCatchPattern":"try {\n    applyScanFiles(handle);\n} catch (TableNotFoundException e) {\n    // table dropped/renamed mid-flight: re-acquire handle or abort gracefully\n    logger.warn(\"Table %s no longer exists; refreshing handle\", e.getTableName());\n    handle = refreshTableHandle(handle);\n}","preventionTips":["Avoid concurrent DROP/RENAME while dependent queries run.","Re-resolve table handles after long idle periods instead of caching them.","Monitor metastore availability to distinguish drops from transient outages."],"tags":["iceberg","table-not-found","metadata","stale-handle"],"backgroundTag":"table-not-found","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}