{"record":{"id":"fa94d78bcba9add4","repo":"prestodb/presto","slug":"iceberg-invalid-materialized-view","errorCode":"ICEBERG_INVALID_MATERIALIZED_VIEW","errorMessage":"Invalid materialized view format version: %s","messagePattern":"Invalid materialized view format version: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java","lineNumber":2106,"sourceCode":"        if (!viewMetadata.isPresent() || !viewMetadata.get().isMaterializedView()) {\n            return Optional.empty();\n        }\n\n        Map<String, String> viewProperties = viewMetadata.get().getProperties();\n        String originalSql = viewProperties.get(PRESTO_MATERIALIZED_VIEW_ORIGINAL_SQL);\n\n        if (originalSql == null) {\n            return Optional.empty();\n        }\n\n        // Validate format version\n        String formatVersion = getRequiredMaterializedViewProperty(viewProperties, PRESTO_MATERIALIZED_VIEW_FORMAT_VERSION);\n        int version;\n        try {\n            version = Integer.parseInt(formatVersion);\n        }\n        catch (NumberFormatException e) {\n            throw new PrestoException(ICEBERG_INVALID_MATERIALIZED_VIEW,\n                    format(\"Invalid materialized view format version: %s\", formatVersion));\n        }\n\n        if (version != CURRENT_MATERIALIZED_VIEW_FORMAT_VERSION) {\n            throw new PrestoException(ICEBERG_INVALID_MATERIALIZED_VIEW,\n                    format(\"Materialized view format version %d is not supported by this version of Presto (current version: %d). Please upgrade Presto.\",\n                            version, CURRENT_MATERIALIZED_VIEW_FORMAT_VERSION));\n        }\n\n        String baseTablesStr = getRequiredMaterializedViewProperty(viewProperties, PRESTO_MATERIALIZED_VIEW_BASE_TABLES);\n        List<SchemaTableName> baseTables;\n        if (baseTablesStr.isEmpty()) {\n            baseTables = ImmutableList.of();\n        }\n        else {\n            baseTables = deserializeSchemaTableNames(baseTablesStr);\n        }\n","sourceCodeStart":2088,"sourceCodeEnd":2124,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java#L2088-L2124","documentation":"Materialized-view loading parses the required PRESTO_MATERIALIZED_VIEW_FORMAT_VERSION property to an int; when the stored version string is missing/blank or not a number (or outside known versions), this error reports the invalid value, indicating a corrupted or hand-edited materialized-view metadata property.","triggerScenarios":"Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java:2106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Drop and recreate the materialized view so the format-version property is written correctly","Fix the property value in the view's metadata to a valid integer version"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}