{"record":{"id":"22d06a45f143f3ee","repo":"juicedata/juicefs","slug":"unsupported-bytemultiple-smultiple","errorCode":null,"errorMessage":"Unsupported ByteMultiple \" + sMultiple","messagePattern":"Unsupported ByteMultiple \" \\+ sMultiple","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/bench/TestDFSIO.java","lineNumber":155,"sourceCode":"        return MB;\n      }\n      String sMU = sMultiple.toUpperCase(Locale.ENGLISH);\n      if (B.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {\n        return B;\n      }\n      if (KB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {\n        return KB;\n      }\n      if (MB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {\n        return MB;\n      }\n      if (GB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {\n        return GB;\n      }\n      if (TB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {\n        return TB;\n      }\n      throw new IllegalArgumentException(\"Unsupported ByteMultiple \" + sMultiple);\n    }\n  }\n\n  public TestDFSIO() {\n    this.config = new Configuration();\n  }\n\n  @Override\n  public void init() throws IOException {\n    this.config = new Configuration();\n    config.setBoolean(\"dfs.support.append\", true);\n    this.fs = new Path(baseDir).getFileSystem(config);\n\n    checkArgs();\n    switch (testType) {\n      case \"-read\":\n        type = TestType.TEST_TYPE_READ;\n        break;","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/bench/TestDFSIO.java#L137-L173","documentation":"TestDFSIO's ByteMultiple.parseString tries to match the size-suffix string (sMU) against KB/MB/GB/TB by suffix comparison and throws IllegalArgumentException \"Unsupported ByteMultiple ...\" when nothing matches. It guards the human-readable size argument (e.g. 1GB, 100MB) passed to the benchmark.","triggerScenarios":"Passing -size with an unrecognized or missing multiple suffix (e.g. -size 500, -size 1kb with unsupported casing variants, -size 1PB) to TestDFSIO.","commonSituations":"Copying CLI examples using PB or lowercase-only suffixes not covered by the parser; forgetting the suffix entirely when scripting; locale-sensitive expectations about uppercase/lowercase handling.","solutions":["Use a supported suffix: KB, MB, GB or TB (case variants ending with those), e.g. -size 1GB.","Ensure the value includes the unit string; a bare number yields an unmatched suffix.","If a larger unit is needed, convert to TB manually (e.g. 5PB = 5120TB).","Or patch the enum to add the unit if you own the benchmark code."],"exampleFix":"// before\nTestDFSIO -write -size 500   // no unit -> IllegalArgumentException\n// after\nTestDFSIO -write -size 500MB","handlingStrategy":"validation","validationCode":"private static final java.util.Set<String> UNITS = java.util.Set.of(\"KB\",\"MB\",\"GB\",\"TB\");\nstatic void assertSize(String arg) {\n  String unit = arg.replaceAll(\"^[0-9]+\", \"\").toUpperCase(java.util.Locale.ENGLISH);\n  if (UNITS.stream().noneMatch(unit::endsWith)) throw new IllegalArgumentException(\"unsupported size unit: \" + arg);\n}","typeGuard":null,"tryCatchPattern":"try {\n  runTestDFSIO(args);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unsupported ByteMultiple\")) {\n    throw new IllegalArgumentException(\"use -size <n>KB|MB|GB|TB, e.g. -size 1GB\", e);\n  }\n  throw e;\n}","preventionTips":["Always include a unit suffix with -size.","Restrict scripts to KB/MB/GB/TB; convert larger units manually.","Validate CLI args in a wrapper before submitting the Hadoop job."],"tags":["java","cli","benchmark","argument-parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}