prestodb/presto · error · PrestoException
NOT_FOUND
NOT_FOUND
Error message
Materialized view not found:
What it means
An Iceberg materialized view operation attempted to read the backing metastore table but the metastore threw TableNotFoundException. Presto translates that into NOT_FOUND with 'Materialized view not found: <name>', meaning no table exists under that schema/name in the metastore.
Source
Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java:839
catch (TableAlreadyExistsException e) {
throw new PrestoException(ALREADY_EXISTS, "Materialized view already exists: " + viewName);
}
}
@Override
protected void dropIcebergView(ConnectorSession session, SchemaTableName schemaTableName)
{
MetastoreContext metastoreContext = getMetastoreContext(session);
try {
metastore.dropTable(
metastoreContext,
schemaTableName.getSchemaName(),
schemaTableName.getTableName(),
true);
}
catch (TableNotFoundException e) {
throw new PrestoException(NOT_FOUND, "Materialized view not found: " + schemaTableName);
}
}
@Override
protected void updateIcebergViewProperties(
ConnectorSession session,
SchemaTableName viewName,
Map<String, String> properties)
{
MetastoreContext metastoreContext = getMetastoreContext(session);
try (HiveMetastoreLock ignored = HiveMetastoreLock.acquire(
metastore,
metastoreContext,
hiveTableOperationsConfig.getLockingEnabled(),
viewName.getSchemaName(),
viewName.getTableName())) {
Optional<Table> existingTable = getHiveTable(session, viewName);
if (!existingTable.isPresent() || !isIcebergMaterializedView(existingTable.get())) {View on GitHub (pinned to 55bb57d202)
Solutions
- Verify the fully qualified name with SHOW TABLES FROM <schema> (MVs appear as tables)
- Create the materialized view if it never existed: CREATE MATERIALIZED VIEW ...
- Check you are querying the intended catalog (iceberg vs hive connector namespace)
- If the backing table was deleted accidentally, restore it from the metastore/backup
Example fix
// before REFRESH MATERIALIZED VIEW sales.daily_mv; -- NOT_FOUND // after SHOW TABLES FROM sales; -- confirm name CREATE MATERIALIZED VIEW sales.daily_mv AS SELECT ...; -- or fix the name
Defensive patterns
Strategy: try-catch
Validate before calling
-- Verify the MV exists before operating on it: SHOW TABLES FROM sales LIKE 'daily_mv';
Try / catch
try {
stmt.execute("REFRESH MATERIALIZED VIEW sales.daily_mv");
} catch (SQLException e) {
if (e.getMessage() != null && e.getMessage().contains("not found")) {
// create the MV or fix the catalog/schema/name, then retry
} else { throw e; }
} Prevention
- Use fully qualified, catalog-correct names in jobs
- Never delete backing MV tables directly via the Hive metastore
- Environment-name linters/config templates to avoid dev/prod name drift
- Add existence checks to refresh orchestration
When it happens
Trigger: REFRESH/DROP or other MV operations referencing a materialized view name that was never created or has been dropped; querying after the backing table was removed out-of-band via the metastore.
Common situations: Typos in schema or view name; wrong catalog prefix; another team/job dropped the backing table directly in Hive; environment drift between dev and prod names.
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
- Materialized view not found
- NOT_FOUND
- ALREADY_EXISTS
- INVALID_TABLE_PROPERTY
- INVALID_MATERIALIZED_VIEW_PROPERTY
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/c54644979bb404bf.
Report an issue: GitHub.