{"record":{"id":"325191abba100e21","repo":"prestodb/presto","slug":"min-input-files-must-be-a-valid-integer-got-s","errorCode":null,"errorMessage":"min-input-files must be a valid integer, got: %s","messagePattern":"min-input-files must be a valid integer, got: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java","lineNumber":1791,"sourceCode":"     * @throws IllegalArgumentException if the value is invalid\n     */\n    public static int parseMinInputFiles(Map<String, String> options)\n    {\n        String minInputFilesStr = options.get(\"min-input-files\");\n        if (minInputFilesStr == null) {\n            return DEFAULT_MIN_INPUT_FILES;\n        }\n\n        try {\n            int minInputFiles = Integer.parseInt(minInputFilesStr);\n            if (minInputFiles < 1) {\n                throw new IllegalArgumentException(\n                    String.format(\"min-input-files must be at least 1, got: %s\", minInputFiles));\n            }\n            return minInputFiles;\n        }\n        catch (NumberFormatException e) {\n            throw new IllegalArgumentException(\n                String.format(\"min-input-files must be a valid integer, got: %s\", minInputFilesStr), e);\n        }\n    }\n\n    /**\n     * Parses and validates the min-file-size-bytes option value.\n     * Returns the parsed long value, or 0 if the option is not present.\n     *\n     * @param options rewrite options map\n     * @return minimum file size threshold in bytes\n     * @throws IllegalArgumentException if the value is invalid\n     */\n    public static long parseMinFileSize(Map<String, String> options)\n    {\n        String minFileSizeStr = options.get(\"min-file-size-bytes\");\n        if (minFileSizeStr == null) {\n            return 0;\n        }","sourceCodeStart":1773,"sourceCodeEnd":1809,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java#L1773-L1809","documentation":"The min-input-files option value must parse as an int; when Integer.parseInt throws NumberFormatException, the parser rethrows IllegalArgumentException with this message wrapping the original exception. The raw, unparseable user string is interpolated into the message.","triggerScenarios":"Calling the optimize/rewrite procedure with min-input-files set to non-numeric text, e.g. 'ten', '1.5', '1_000', '1e3', or a value with stray whitespace/quotes.","commonSituations":"Passing a double like 1.5 from scripting glue; decimal separators from locale settings; quoting mistakes that include quotes inside the value; templating that left a placeholder unresolved.","solutions":["Provide a plain base-10 integer string, e.g. '10'.","Normalize the value before calling: strip whitespace and cast/round in client code.","If a fraction is intended, use min-file-size-bytes style options or round to an integer explicitly."],"exampleFix":"// before\nCALL system.optimize('db.t', map(ARRAY['min_input_files'], ARRAY['1.5']));\n// after\nCALL system.optimize('db.t', map(ARRAY['min_input_files'], ARRAY['2']));","handlingStrategy":"validation","validationCode":"String v = raw.trim();\nif (!v.matches(\"\\\\d+\")) throw new IllegalArgumentException(\"min-input-files must be a plain integer\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build option maps with typed values (int) and convert via String.valueOf, never hand-formatted strings.","Strip whitespace and reject fractions before invoking the procedure.","Add unit tests covering option serialization for optimizer calls."],"tags":["iceberg","validation","number-format","argument-parsing"],"backgroundTag":"invalid-procedure-option-value","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"}