juicedata/juicefs · error · IllegalArgumentException

Unsupported ByteMultiple " + sMultiple

Error message

Unsupported ByteMultiple " + sMultiple

What it means

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.

Source

Thrown at sdk/java/src/main/java/io/juicefs/bench/TestDFSIO.java:155

        return MB;
      }
      String sMU = sMultiple.toUpperCase(Locale.ENGLISH);
      if (B.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {
        return B;
      }
      if (KB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {
        return KB;
      }
      if (MB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {
        return MB;
      }
      if (GB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {
        return GB;
      }
      if (TB.name().toUpperCase(Locale.ENGLISH).endsWith(sMU)) {
        return TB;
      }
      throw new IllegalArgumentException("Unsupported ByteMultiple " + sMultiple);
    }
  }

  public TestDFSIO() {
    this.config = new Configuration();
  }

  @Override
  public void init() throws IOException {
    this.config = new Configuration();
    config.setBoolean("dfs.support.append", true);
    this.fs = new Path(baseDir).getFileSystem(config);

    checkArgs();
    switch (testType) {
      case "-read":
        type = TestType.TEST_TYPE_READ;
        break;

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Use a supported suffix: KB, MB, GB or TB (case variants ending with those), e.g. -size 1GB.
  2. Ensure the value includes the unit string; a bare number yields an unmatched suffix.
  3. If a larger unit is needed, convert to TB manually (e.g. 5PB = 5120TB).
  4. Or patch the enum to add the unit if you own the benchmark code.

Example fix

// before
TestDFSIO -write -size 500   // no unit -> IllegalArgumentException
// after
TestDFSIO -write -size 500MB
Defensive patterns

Strategy: validation

Validate before calling

private static final java.util.Set<String> UNITS = java.util.Set.of("KB","MB","GB","TB");
static void assertSize(String arg) {
  String unit = arg.replaceAll("^[0-9]+", "").toUpperCase(java.util.Locale.ENGLISH);
  if (UNITS.stream().noneMatch(unit::endsWith)) throw new IllegalArgumentException("unsupported size unit: " + arg);
}

Try / catch

try {
  runTestDFSIO(args);
} catch (IllegalArgumentException e) {
  if (e.getMessage().startsWith("Unsupported ByteMultiple")) {
    throw new IllegalArgumentException("use -size <n>KB|MB|GB|TB, e.g. -size 1GB", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing -size with an unrecognized or missing multiple suffix (e.g. -size 500, -size 1kb with unsupported casing variants, -size 1PB) to TestDFSIO.

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/22d06a45f143f3ee. Report an issue: GitHub.