{"record":{"id":"de831521bd5e55ab","repo":"prestodb/presto","slug":"not-supported-de8315","errorCode":"NOT_SUPPORTED","errorMessage":"Invalid rewrite strategy: %s. Valid values are 'sort' or 'binpack'.","messagePattern":"Invalid rewrite strategy: (.+?)\\. Valid values are 'sort' or 'binpack'\\.","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/procedure/RewriteDataFilesProcedure.java","lineNumber":173,"sourceCode":"     * Parses the `strategy` procedure argument, defaulting to {@link RewriteStrategy#BINPACK} when it is not specified.\n     *\n     * @throws PrestoException if the value is not a recognized strategy\n     */\n    private static RewriteStrategy parseStrategy(Object[] procedureArgs)\n    {\n        if (procedureArgs.length <= STRATEGY_ARGUMENT_INDEX || procedureArgs[STRATEGY_ARGUMENT_INDEX] == null) {\n            return RewriteStrategy.BINPACK;\n        }\n\n        Object strategyArgument = procedureArgs[STRATEGY_ARGUMENT_INDEX];\n        String strategyStr = strategyArgument instanceof Slice ?\n                ((Slice) strategyArgument).toStringUtf8() :\n                strategyArgument.toString();\n        try {\n            return RewriteStrategy.valueOf(strategyStr.trim().toUpperCase(Locale.ENGLISH));\n        }\n        catch (IllegalArgumentException e) {\n            throw new PrestoException(NOT_SUPPORTED,\n                    format(\"Invalid rewrite strategy: %s. Valid values are 'sort' or 'binpack'.\", strategyStr));\n        }\n    }\n\n    private static Map<String, String> extractAndValidateOptions(Object[] procedureArgs)\n    {\n        Map<String, String> options = ImmutableMap.of();\n        if (procedureArgs.length > OPTIONS_ARGUMENT_INDEX && procedureArgs[OPTIONS_ARGUMENT_INDEX] instanceof Map) {\n            options = (Map<String, String>) procedureArgs[OPTIONS_ARGUMENT_INDEX];\n\n            // Validate options if present using utility methods\n            parseMinInputFiles(options);\n            parseMinFileSize(options);\n            parseMaxFileSize(options);\n            parseRewriteAll(options);\n        }\n        return options;\n    }","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/procedure/RewriteDataFilesProcedure.java#L155-L191","documentation":"NOT_SUPPORTED thrown by parseStrategy when the strategy argument of rewrite_data_files cannot be parsed into a RewriteStrategy enum. Only 'sort' and 'binpack' are valid; any other string fails valueOf and produces this error listing the accepted values.","triggerScenarios":"Calling the rewrite_data_files procedure with procedure argument strategy set to a string other than 'sort' or 'binpack' (case-insensitive after trim), e.g. 'zorder', 'compact', or a misspelled value.","commonSituations":"Copy-pasted SQL from docs of a different engine that supports more strategies (e.g. zorder in other Iceberg runtimes); typo like 'bin-pack' or 'BinPack' with punctuation; passing NULL/garbage from a script.","solutions":["Change the strategy argument to 'sort' or 'binpack' (case-insensitive)","If aiming for z-order compaction, use the engine/documentation version that supports it, or use the table's sort order with strategy='sort'","Check spelling/hyphenation: 'binpack', not 'bin-pack'"],"exampleFix":"// before\nCALL system.rewrite_data_files('s', 't', strategy => 'zorder')\n// after\nCALL system.rewrite_data_files('s', 't', strategy => 'binpack')","handlingStrategy":"validation","validationCode":"// Validate the strategy value client-side before calling the procedure\nSet<String> valid = Set.of(\"sort\", \"binpack\");\nif (strategy == null || !valid.contains(strategy.trim().toLowerCase(Locale.ROOT))) {\n    throw new IllegalArgumentException(\"strategy must be 'sort' or 'binpack'\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass 'sort' or 'binpack' as strategy values","Strip whitespace and rely on case-insensitive matching, but avoid hyphenated variants","Check the docs for your Presto version — extra strategies like zorder may not exist here","Validate procedure arguments in SQL-generation tooling"],"tags":["iceberg","validation","procedure-argument","not-supported"],"backgroundTag":"invalid-argument-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"}