prestodb/presto · error · PrestoException
NOT_FOUND
NOT_FOUND
Error message
Table does not exist: %s
What it means
When the target of ALTER ... SET PROPERTIES has no table handle (the name does not resolve to any table), the handler throws PrestoException(NOT_FOUND) unless the statement was issued with IF EXISTS, in which case it silently returns. The message identifies the fully qualified name that could not be found. This is the existence check after view/materialized-view checks pass.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/SetPropertiesTask.java:102
}
return immediateFuture(null);
}
private void setTableProperties(SetProperties statement, QualifiedObjectName tableName, Metadata metadata, AccessControl accessControl, Session session, Map<String, Object> properties)
{
if (metadata.getMetadataResolver(session).getMaterializedView(tableName).isPresent()) {
throw new PrestoException(NOT_SUPPORTED, "Cannot set table properties to a materialized view");
}
if (metadata.getMetadataResolver(session).getView(tableName).isPresent()) {
throw new PrestoException(NOT_SUPPORTED, "Cannot set table properties to a view");
}
Optional<TableHandle> tableHandle = metadata.getMetadataResolver(session).getTableHandle(tableName);
if (!tableHandle.isPresent()) {
if (!statement.isTableExists()) {
throw new PrestoException(NOT_FOUND, format("Table does not exist: %s", tableName));
}
return;
}
accessControl.checkCanSetTableProperties(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName, properties);
metadata.setTableProperties(session, tableHandle.get(), properties);
}
private void setMaterializedViewProperties(SetProperties statement, QualifiedObjectName viewName, Metadata metadata, AccessControl accessControl, Session session, Map<String, Object> properties)
{
if (!metadata.getMetadataResolver(session).getMaterializedView(viewName).isPresent()) {
if (!statement.isTableExists()) {
throw new PrestoException(NOT_FOUND, format("Materialized view does not exist: %s", viewName));
}
return;
}
accessControl.checkCanSetTableProperties(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), viewName, properties);View on GitHub (pinned to 55bb57d202)
Solutions
- Create the table or correct the name, then re-run the ALTER.
- Add IF EXISTS to make missing tables a no-op: ALTER TABLE IF EXISTS ... SET PROPERTIES ...
- Qualify the name with the correct catalog.schema and verify with SHOW TABLES.
Example fix
-- before ALTER TABLE old_schema.orders SET PROPERTIES ... -- after ALTER TABLE IF EXISTS analytics.orders SET PROPERTIES ...
Defensive patterns
Strategy: validation
Validate before calling
SELECT 1 FROM information_schema.tables WHERE table_catalog='<cat>' AND table_schema='<sch>' AND table_name='<name>'; -- only run ALTER ... SET PROPERTIES if a row is returned
Try / catch
try {
await run("ALTER TABLE t SET PROPERTIES ...");
} catch (e) {
if (e.message.includes("Table does not exist")) {
console.error(`Target missing; check catalog/schema or use IF EXISTS: ${e.message}`);
}
throw e;
} Prevention
- Fully qualify catalog.schema.table in all DDL.
- Use IF EXISTS when dropping/recreating flows may race with property changes.
- Verify names with SHOW TABLES before scripting ALTERs.
- Sync environment inventories (dev vs prod) before migrations.
When it happens
Trigger: ALTER TABLE <name> SET PROPERTIES ... where <name> does not exist and IF EXISTS was not specified.
Common situations: Typos in table names; wrong catalog or schema in the session; table dropped concurrently or never created; environment drift between dev and prod.
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/238a64116677d34b.
Report an issue: GitHub.