{"record":{"id":"c54644979bb404bf","repo":"prestodb/presto","slug":"not-found-c54644","errorCode":"NOT_FOUND","errorMessage":"Materialized view not found: ","messagePattern":"Materialized view not found: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java","lineNumber":839,"sourceCode":"        catch (TableAlreadyExistsException e) {\n            throw new PrestoException(ALREADY_EXISTS, \"Materialized view already exists: \" + viewName);\n        }\n    }\n\n    @Override\n    protected void dropIcebergView(ConnectorSession session, SchemaTableName schemaTableName)\n    {\n        MetastoreContext metastoreContext = getMetastoreContext(session);\n\n        try {\n            metastore.dropTable(\n                    metastoreContext,\n                    schemaTableName.getSchemaName(),\n                    schemaTableName.getTableName(),\n                    true);\n        }\n        catch (TableNotFoundException e) {\n            throw new PrestoException(NOT_FOUND, \"Materialized view not found: \" + schemaTableName);\n        }\n    }\n\n    @Override\n    protected void updateIcebergViewProperties(\n            ConnectorSession session,\n            SchemaTableName viewName,\n            Map<String, String> properties)\n    {\n        MetastoreContext metastoreContext = getMetastoreContext(session);\n        try (HiveMetastoreLock ignored = HiveMetastoreLock.acquire(\n                metastore,\n                metastoreContext,\n                hiveTableOperationsConfig.getLockingEnabled(),\n                viewName.getSchemaName(),\n                viewName.getTableName())) {\n            Optional<Table> existingTable = getHiveTable(session, viewName);\n            if (!existingTable.isPresent() || !isIcebergMaterializedView(existingTable.get())) {","sourceCodeStart":821,"sourceCodeEnd":857,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java#L821-L857","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nREFRESH MATERIALIZED VIEW sales.daily_mv; -- NOT_FOUND\n// after\nSHOW TABLES FROM sales; -- confirm name\nCREATE MATERIALIZED VIEW sales.daily_mv AS SELECT ...; -- or fix the name","handlingStrategy":"try-catch","validationCode":"-- Verify the MV exists before operating on it:\nSHOW TABLES FROM sales LIKE 'daily_mv';","typeGuard":null,"tryCatchPattern":"try {\n    stmt.execute(\"REFRESH MATERIALIZED VIEW sales.daily_mv\");\n} catch (SQLException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"not found\")) {\n        // create the MV or fix the catalog/schema/name, then retry\n    } else { throw e; }\n}","preventionTips":["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"],"tags":["iceberg","materialized-view","not-found"],"backgroundTag":"materialized-view-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"}