{"record":{"id":"0e70a20852403339","repo":"prestodb/presto","slug":"iceberg-invalid-format-version-0e70a2","errorCode":"ICEBERG_INVALID_FORMAT_VERSION","errorMessage":"Unable to parse user provided format version","messagePattern":"Unable to parse user provided format version","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java","lineNumber":1460,"sourceCode":"\n        propertiesBuilder.put(SPLIT_SIZE, String.valueOf(IcebergTableProperties.getTargetSplitSize(tableMetadata.getProperties())));\n\n        isHiveLocksEnabled(tableMetadata.getProperties()).ifPresent(value -> propertiesBuilder.put(HIVE_LOCK_ENABLED, value));\n\n        return propertiesBuilder.build();\n    }\n\n    public static int parseFormatVersion(String formatVersion)\n    {\n        try {\n            int version = parseInt(formatVersion);\n            if (version > MAX_SUPPORTED_FORMAT_VERSION) {\n                throw new PrestoException(NOT_SUPPORTED, format(\"Iceberg table format version %d is not supported\", version));\n            }\n            return version;\n        }\n        catch (NumberFormatException | IndexOutOfBoundsException e) {\n            throw new PrestoException(ICEBERG_INVALID_FORMAT_VERSION, \"Unable to parse user provided format version\");\n        }\n    }\n\n    public static RowLevelOperationMode getDeleteMode(Table table)\n    {\n        return RowLevelOperationMode.fromName(table.properties()\n                .getOrDefault(DELETE_MODE, DELETE_MODE_DEFAULT)\n                .toUpperCase(Locale.ENGLISH));\n    }\n\n    public static RowLevelOperationMode getUpdateMode(Table table)\n    {\n        return RowLevelOperationMode.fromName(table.properties()\n                .getOrDefault(UPDATE_MODE, UPDATE_MODE_DEFAULT)\n                .toUpperCase(Locale.ENGLISH));\n    }\n\n    public static int getMetadataPreviousVersionsMax(Table table)","sourceCodeStart":1442,"sourceCodeEnd":1478,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java#L1442-L1478","documentation":"parseFormatVersion converts a user-supplied format version string to an int with parseInt. If the string is not a valid integer (or is out of bounds), it throws ICEBERG_INVALID_FORMAT_VERSION. This distinguishes malformed input from a valid-but-unsupported version (which raises NOT_SUPPORTED instead).","triggerScenarios":"Calling IcebergUtil.parseFormatVersion with a null, empty, non-numeric, or otherwise unparseable string (e.g. 'abc', '', 'v2', '1.5').","commonSituations":"Typo in a session/catalog property value; a config template left with a placeholder like '${FORMAT_VERSION}'; passing a version qualifier like '2.0' where only plain integers are accepted.","solutions":["Set the format version to a plain integer string (e.g. '1' or '2'), not 'v1', '1.0', or a placeholder","Check the session property / catalog config that supplies format_version and remove nulls or empty values","Ensure any tooling generating the property emits an unquoted integer without suffixes or whitespace"],"exampleFix":"// before\nSET SESSION iceberg.format_version = 'v2';\n// after\nSET SESSION iceberg.format_version = '2';","handlingStrategy":"validation","validationCode":"if (formatVersion == null || !formatVersion.trim().matches(\"^\\\\d+$\")) {\n    throw new IllegalArgumentException(\n        \"format version must be a plain integer string, got: \" + formatVersion);\n}","typeGuard":null,"tryCatchPattern":"try {\n    int v = IcebergUtil.parseFormatVersion(raw);\n} catch (PrestoException e) {\n    if (e.getErrorCode() == ICEBERG_INVALID_FORMAT_VERSION.toErrorCode()) {\n        // log raw value and default to a supported version\n    } else {\n        throw e;\n    }\n}","preventionTips":["Always supply format_version as an unquoted plain integer ('2', not 'v2' or '2.0')","Validate config templates so placeholders like ${VAR} are resolved before reaching the connector","Add schema validation on catalog properties at deploy time"],"tags":["iceberg","invalid-input","parsing"],"backgroundTag":"invalid-numeric-input","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"}