{"record":{"id":"2f02d7c141e7a52f","repo":"prestodb/presto","slug":"not-found-2f02d7","errorCode":"NOT_FOUND","errorMessage":"Table ${tableName} not found","messagePattern":"Table (.+?) not found","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/connector/system/SystemPageSourceProvider.java","lineNumber":73,"sourceCode":"    {\n        this.tables = requireNonNull(tables, \"tables is null\");\n    }\n\n    @Override\n    public ConnectorPageSource createPageSource(\n            ConnectorTransactionHandle transactionHandle,\n            ConnectorSession session,\n            ConnectorSplit split,\n            List<ColumnHandle> columns,\n            SplitContext splitContext)\n    {\n        requireNonNull(columns, \"columns is null\");\n        SystemTransactionHandle systemTransaction = (SystemTransactionHandle) transactionHandle;\n        SystemSplit systemSplit = (SystemSplit) split;\n        SchemaTableName tableName = systemSplit.getTableHandle().getSchemaTableName();\n        SystemTable systemTable = tables.getSystemTable(session, tableName)\n                // table might disappear in the meantime\n                .orElseThrow(() -> new PrestoException(NOT_FOUND, format(\"Table %s not found\", tableName)));\n\n        List<ColumnMetadata> tableColumns = systemTable.getTableMetadata().getColumns();\n\n        Map<String, Integer> columnsByName = new HashMap<>();\n        for (int i = 0; i < tableColumns.size(); i++) {\n            ColumnMetadata column = tableColumns.get(i);\n            if (columnsByName.put(column.getName(), i) != null) {\n                throw new PrestoException(GENERIC_INTERNAL_ERROR, \"Duplicate column name: \" + column.getName());\n            }\n        }\n\n        ImmutableList.Builder<Integer> userToSystemFieldIndex = ImmutableList.builder();\n        for (ColumnHandle column : columns) {\n            String columnName = ((SystemColumnHandle) column).getColumnName();\n\n            Integer index = columnsByName.get(columnName);\n            if (index == null) {\n                throw new PrestoException(GENERIC_INTERNAL_ERROR, format(\"Column does not exist: %s.%s\", tableName, columnName));","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/connector/system/SystemPageSourceProvider.java#L55-L91","documentation":"SystemPageSourceProvider.createPageSource resolves the SystemTable for the split's SchemaTableName via tables.getSystemTable(...). If the table is absent it throws NOT_FOUND — the code comments that the table 'might disappear in the meantime', since system table registration is dynamic (e.g. connector/catalog changes) and the split may outlive the table registration.","triggerScenarios":"Executing a query against a system table whose registration is removed between split scheduling and split execution (connector reconfiguration, catalog dropped/replaced mid-query); stale split replay after a catalog change.","commonSituations":"Long-running or retried queries spanning a catalog redeploy; connectors whose dynamic system tables are re-registered under new names; querying a system table from a session whose catalog was swapped.","solutions":["Re-run the query after the catalog/connector change completes; the table will resolve at plan time.","Avoid reconfiguring or reloading the connector/catalog while queries against its system tables are in flight.","If it persists, verify the system table is still registered (system metadata / connector logs) and check the connector version."],"exampleFix":"// before\nSystemTable systemTable = tables.getSystemTable(session, tableName)\n    .orElseThrow(() -> new PrestoException(NOT_FOUND, format(\"Table %s not found\", tableName)));\n// after\nSystemTable systemTable = tables.getSystemTable(session, tableName)\n    .orElseThrow(() -> new PrestoException(NOT_FOUND, format(\"Table %s not found (may have been unregistered mid-query; retry the query)\", tableName)));","handlingStrategy":"retry","validationCode":"boolean registered = tables.getSystemTable(session, tableName).isPresent();\nif (!registered) throw new IllegalStateException(\"System table \" + tableName + \" is not registered; avoid catalog reloads mid-query\");","typeGuard":null,"tryCatchPattern":"try { execute(); }\ncatch (PrestoException e) { if (e.getErrorCode() == StandardErrorCode.NOT_FOUND.toErrorCode() && attempts < 2) { retryWithBackoff(); } else throw e; }","preventionTips":["Do not reload/redeploy catalogs while queries run","Retry transient NOT_FOUND on system table reads once","Check connector registration after any catalog change"],"tags":["system-tables","not-found","transient"],"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"}