prestodb/presto · error · PrestoException
NOT_FOUND
NOT_FOUND
Error message
Table ${tableName} not found What it means
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.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/connector/system/SystemPageSourceProvider.java:73
{
this.tables = requireNonNull(tables, "tables is null");
}
@Override
public ConnectorPageSource createPageSource(
ConnectorTransactionHandle transactionHandle,
ConnectorSession session,
ConnectorSplit split,
List<ColumnHandle> columns,
SplitContext splitContext)
{
requireNonNull(columns, "columns is null");
SystemTransactionHandle systemTransaction = (SystemTransactionHandle) transactionHandle;
SystemSplit systemSplit = (SystemSplit) split;
SchemaTableName tableName = systemSplit.getTableHandle().getSchemaTableName();
SystemTable systemTable = tables.getSystemTable(session, tableName)
// table might disappear in the meantime
.orElseThrow(() -> new PrestoException(NOT_FOUND, format("Table %s not found", tableName)));
List<ColumnMetadata> tableColumns = systemTable.getTableMetadata().getColumns();
Map<String, Integer> columnsByName = new HashMap<>();
for (int i = 0; i < tableColumns.size(); i++) {
ColumnMetadata column = tableColumns.get(i);
if (columnsByName.put(column.getName(), i) != null) {
throw new PrestoException(GENERIC_INTERNAL_ERROR, "Duplicate column name: " + column.getName());
}
}
ImmutableList.Builder<Integer> userToSystemFieldIndex = ImmutableList.builder();
for (ColumnHandle column : columns) {
String columnName = ((SystemColumnHandle) column).getColumnName();
Integer index = columnsByName.get(columnName);
if (index == null) {
throw new PrestoException(GENERIC_INTERNAL_ERROR, format("Column does not exist: %s.%s", tableName, columnName));View on GitHub (pinned to 55bb57d202)
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.
Example fix
// before
SystemTable systemTable = tables.getSystemTable(session, tableName)
.orElseThrow(() -> new PrestoException(NOT_FOUND, format("Table %s not found", tableName)));
// after
SystemTable systemTable = tables.getSystemTable(session, tableName)
.orElseThrow(() -> new PrestoException(NOT_FOUND, format("Table %s not found (may have been unregistered mid-query; retry the query)", tableName))); Defensive patterns
Strategy: retry
Validate before calling
boolean registered = tables.getSystemTable(session, tableName).isPresent();
if (!registered) throw new IllegalStateException("System table " + tableName + " is not registered; avoid catalog reloads mid-query"); Try / catch
try { execute(); }
catch (PrestoException e) { if (e.getErrorCode() == StandardErrorCode.NOT_FOUND.toErrorCode() && attempts < 2) { retryWithBackoff(); } else throw e; } Prevention
- Do not reload/redeploy catalogs while queries run
- Retry transient NOT_FOUND on system table reads once
- Check connector registration after any catalog change
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: NOT_FOUND error code: why tRPC, Harbor, Nacos and other libraries return 404 "not found" errors for resources that may still exist — this error's family across 11 libraries.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/2f02d7c141e7a52f.
Report an issue: GitHub.