prestodb/presto · error · TableNotFoundException
NOT_FOUND
NOT_FOUND
Error message
Table '%s' not found
What it means
Thrown by AccumuloMetadata.getTableMetadata when a ConnectorTableHandle resolves to a table that does not exist in the Accumulo metadata client. Presto's connector SPI requires NOT_FOUND errors to be signaled via TableNotFoundException so the engine surfaces 'Table not found' to the query planner.
Source
Thrown at presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloMetadata.java:287
ConnectorTableLayout layout = new ConnectorTableLayout(new AccumuloTableLayoutHandle(tableHandle, constraint.getSummary()));
return new ConnectorTableLayoutResult(layout, constraint.getSummary());
}
@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
return new ConnectorTableLayout(handle);
}
@Override
public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle table)
{
AccumuloTableHandle handle = (AccumuloTableHandle) table;
checkArgument(handle.getConnectorId().equals(connectorId), "table is not for this connector");
SchemaTableName tableName = new SchemaTableName(handle.getSchema(), handle.getTable());
ConnectorTableMetadata metadata = getTableMetadata(session, tableName);
if (metadata == null) {
throw new TableNotFoundException(tableName);
}
return metadata;
}
@Override
public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle)
{
AccumuloTableHandle handle = (AccumuloTableHandle) tableHandle;
checkArgument(handle.getConnectorId().equals(connectorId), "tableHandle is not for this connector");
AccumuloTable table = client.getTable(handle.toSchemaTableName());
if (table == null) {
throw new TableNotFoundException(handle.toSchemaTableName());
}
ImmutableMap.Builder<String, ColumnHandle> columnHandles = ImmutableMap.builder();
for (AccumuloColumnHandle column : table.getColumns()) {
columnHandles.put(column.getName(), column);View on GitHub (pinned to 55bb57d202)
Solutions
- Verify the table exists in Accumulo (or via SHOW TABLES in the Presto catalog) using the exact schema and table name from the handle
- Re-create the table with CREATE TABLE if it was dropped, or re-run CREATE EXTERNAL TABLE if it was an external Accumulo table
- Refresh Presto metadata/state (restart or clear cached handles) if the table was recently renamed or dropped out-of-band
- Confirm the connectorId in the handle matches the current catalog configuration
Example fix
// before
ConnectorTableMetadata metadata = getTableMetadata(session, tableName);
if (metadata == null) {
throw new TableNotFoundException(tableName);
}
// after (caller-side guard)
if (!tableExists(session, tableName)) {
throw new TableNotFoundException(tableName);
}
return getTableMetadata(session, tableName); Defensive patterns
Strategy: validation
Validate before calling
SchemaTableName t = handle.toSchemaTableName(); if (client.getTable(t) == null) throw new TableNotFoundException(t);
Try / catch
catch (TableNotFoundException e) { /* refresh metadata or fail query */ } Prevention
- Check SHOW TABLES first
- Avoid out-of-band Accumulo drops
When it happens
Trigger: Calling getTableMetadata (via metadata/tableMetadata SPI paths) with an AccumuloTableHandle whose schema/table no longer exists in Accumulo, or was never created by this connector.
Common situations: Table dropped externally in Accumulo while Presto cached or planned against it; typo in schema/table name; connector id mismatch after catalog reconfiguration; stale metadata after manual Accumulo shell drops.
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/1647429ed756d185.
Report an issue: GitHub.