{"record":{"id":"b0fddf6857b4bf4b","repo":"prestodb/presto","slug":"max-file-size-bytes-must-be-a-valid-long-got-s","errorCode":null,"errorMessage":"max-file-size-bytes must be a valid long, got: %s","messagePattern":"max-file-size-bytes must be a valid long, got: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java","lineNumber":1845,"sourceCode":"     *\n     * @throws IllegalArgumentException if the value is invalid\n     */\n    public static long parseMaxFileSize(Map<String, String> options)\n    {\n        String maxFileSizeStr = options.get(\"max-file-size-bytes\");\n        if (maxFileSizeStr == null) {\n            return 0;\n        }\n        try {\n            long maxFileSize = Long.parseLong(maxFileSizeStr);\n            if (maxFileSize < 0) {\n                throw new IllegalArgumentException(\n                    String.format(\"max-file-size-bytes must be non-negative, got: %s\", maxFileSize));\n            }\n            return maxFileSize;\n        }\n        catch (NumberFormatException e) {\n            throw new IllegalArgumentException(\n                String.format(\"max-file-size-bytes must be a valid long, got: %s\", maxFileSizeStr), e);\n        }\n    }\n\n    /**\n     * Parses and validates the rewrite-all option value.\n     * Returns true if the option is set to \"true\", false otherwise.\n     */\n    public static boolean parseRewriteAll(Map<String, String> options)\n    {\n        String rewriteAllStr = options.get(\"rewrite-all\");\n        if (rewriteAllStr == null) {\n            return false;\n        }\n        return Boolean.parseBoolean(rewriteAllStr.trim());\n    }\n\n    /**","sourceCodeStart":1827,"sourceCodeEnd":1863,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java#L1827-L1863","documentation":"The max-file-size-bytes option must parse as a long; NumberFormatException from Long.parseLong is rethrown as IllegalArgumentException with this message wrapping the cause, interpolating the raw string. Only non-null malformed values reach this path.","triggerScenarios":"Calling optimize with max-file-size-bytes like '512MB', '5.0e8', '512_000_000', or other non-integer strings.","commonSituations":"Human-readable sizes passed verbatim; floats from YAML/JSON config; scientific notation; locale-grouped digits.","solutions":["Provide a raw integer byte string, e.g. '536870912' for 512MB.","Parse unit suffixes client-side before constructing the option map.","Use Long.toString of a long value computed in application code."],"exampleFix":"// before\nCALL system.optimize('db.t', map(ARRAY['max_file_size_bytes'], ARRAY['512MB']));\n// after\nCALL system.optimize('db.t', map(ARRAY['max_file_size_bytes'], ARRAY['536870912']));","handlingStrategy":"validation","validationCode":"String v = raw.trim();\nif (!v.matches(\"\\\\d+\")) throw new IllegalArgumentException(\"max-file-size-bytes must be raw bytes integer\");\nLong.parseLong(v);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do unit conversion client-side; pass plain integers only.","Reject scientific notation and thousands separators at config load.","Centralize option formatting in one utility with tests."],"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"}