{"record":{"id":"1563194800ca46e7","repo":"prestodb/presto","slug":"min-input-files-must-be-at-least-1-got-s","errorCode":null,"errorMessage":"min-input-files must be at least 1, got: %s","messagePattern":"min-input-files must be at least 1, got: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java","lineNumber":1785,"sourceCode":"    }\n\n    /**\n     * Parses and validates the min-input-files option value.\n     * Returns the parsed integer value, or default of {@value #DEFAULT_MIN_INPUT_FILES} if the option is not present.\n     *\n     * @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     */","sourceCodeStart":1767,"sourceCodeEnd":1803,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java#L1767-L1803","documentation":"The Iceberg rewrite-files / optimize option min-input-files accepts a string that is parsed to an int; values below 1 are meaningless (a partition must contain at least one file to be a rewrite candidate), so the parser throws IllegalArgumentException via String.format. The message interpolates the offending raw value.","triggerScenarios":"Calling the Iceberg optimizer/system procedure with option min-input-files='0', '-5', or any integer less than 1.","commonSituations":"Hand-tuning optimize procedure arguments and mistakenly passing 0 thinking it disables the threshold; copy-paste defaults; generating options programmatically with an uninitialized counter.","solutions":["Pass min-input-files = 1 or greater (default used when unset).","Omit the option entirely to fall back to DEFAULT_MIN_INPUT_FILES instead of forcing 0.","Clamp the value in generating code: Math.max(1, configuredValue)."],"exampleFix":"// before\nCALL system.optimize('db.t', map(ARRAY['min_input_files'], ARRAY['0']));\n// after\nCALL system.optimize('db.t', map(ARRAY['min_input_files'], ARRAY['1']));","handlingStrategy":"validation","validationCode":"int minInputFiles = Integer.parseInt(raw);\nif (minInputFiles < 1) throw new IllegalArgumentException(\"min-input-files must be >= 1\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit the option rather than passing 0 to mean 'default'.","Clamp configured values with Math.max(1, value) at config-load time.","Document valid ranges next to procedure call sites in team runbooks."],"tags":["iceberg","validation","procedure-options","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"}