{"record":{"id":"7456ba6f9ba1d917","repo":"apache/iceberg","slug":"invalid-rewrite-job-order-name-s","errorCode":null,"errorMessage":"Invalid rewrite job order name: %s","messagePattern":"Invalid rewrite job order name: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/RewriteJobOrder.java","lineNumber":64,"sourceCode":"\n  private final String orderName;\n\n  RewriteJobOrder(String orderName) {\n    this.orderName = orderName;\n  }\n\n  public String orderName() {\n    return orderName;\n  }\n\n  public static RewriteJobOrder fromName(String orderName) {\n    Preconditions.checkArgument(orderName != null, \"Invalid rewrite job order name: null\");\n    // Replace the hyphen in order name with underscore to map to the enum value. For example:\n    // bytes-asc to BYTES_ASC\n    try {\n      return RewriteJobOrder.valueOf(orderName.replaceFirst(\"-\", \"_\").toUpperCase(Locale.ROOT));\n    } catch (IllegalArgumentException e) {\n      throw new IllegalArgumentException(\n          String.format(\"Invalid rewrite job order name: %s\", orderName), e);\n    }\n  }\n}\n","sourceCodeStart":46,"sourceCodeEnd":69,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/RewriteJobOrder.java#L46-L69","documentation":"RewriteJobOrder.fromName(String) converts a user-supplied order name (e.g. \"bytes-asc\", \"files-desc\") into the RewriteJobOrder enum. If the name, after replacing the first hyphen with an underscore and uppercasing, does not match an enum constant, the underlying valueOf IllegalArgumentException is rethrown with this message naming the invalid input.","triggerScenarios":"Passing an unrecognized rewrite.jobs order string to fromName — e.g. ordering config set to \"bytes ascending\", \"size-asc\", \"bytes-ascending\", or a typo like \"bytes-acc\" in table or procedure configuration.","commonSituations":"Misconfigured rewrite procedure options (rewrite_data_files / rewrite_delete_files sort orders) in Spark SQL, YAML job configs, or CLI flags where the order name was hand-typed.","solutions":["Use one of the valid names: bytes-asc, bytes-desc, files-asc, files-desc, content-asc, content-desc (enum constants BYTES_ASC, BYTES_DESC, FILES_ASC, FILES_DESC, CONTENT_ASC, CONTENT_DESC).","Check for typos and casing; the parser is case-insensitive but requires the exact word and single hyphen separator.","Call RewriteJobOrder.values() or read the enum to list accepted names when unsure."],"exampleFix":"// before\nRewriteJobOrder order = RewriteJobOrder.fromName(\"size-asc\"); // invalid\n// after\nRewriteJobOrder order = RewriteJobOrder.fromName(\"bytes-asc\");","handlingStrategy":"validation","validationCode":"static boolean isValidOrder(String name) {\n  if (name == null) return false;\n  try { RewriteJobOrder.valueOf(name.replaceFirst(\"-\", \"_\").toUpperCase(Locale.ROOT)); return true; }\n  catch (IllegalArgumentException e) { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  order = RewriteJobOrder.fromName(name);\n} catch (IllegalArgumentException e) {\n  order = RewriteJobOrder.BYTES_ASC; // documented default with warning\n}","preventionTips":["Restrict user-facing options to the documented names: bytes-asc/desc, files-asc/desc, content-asc/desc.","Validate order names from config files at load time.","Reuse RewriteJobOrder enum constants instead of hand-writing strings."],"tags":["java","iceberg","enum","config","rewrite-jobs"],"backgroundTag":"invalid-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}