apache/hadoop · error · HdfsCompatIllegalArgumentException

suite " + suiteClassName + " is empty for both API and SHELL

Error message

suite " + suiteClassName + " is empty for both API and SHELL

What it means

A loaded suite must contain at least one API case (getApiCases()) or one shell case (getShellCases()); if both arrays are null or empty, initSuite throws HdfsCompatIllegalArgumentException, because a suite with nothing to run is a broken or half-finished definition.

Source

Thrown at hadoop-tools/hadoop-compat-bench/src/main/java/org/apache/hadoop/fs/compat/common/HdfsCompatCommand.java:104

      this.suite = (HdfsCompatSuite) suiteObj;
    } else {
      throw new HdfsCompatIllegalArgumentException(
          "class name " + suiteClassName + " must be an" +
              " implementation of " + HdfsCompatSuite.class.getName());
    }
    if (suite.getSuiteName() == null || suite.getSuiteName().isEmpty()) {
      throw new HdfsCompatIllegalArgumentException(
          "suite " + suiteClassName + " suiteName is empty");
    }
    for (HdfsCompatSuite defaultSuite : defaultSuites.values()) {
      if (suite.getSuiteName().equalsIgnoreCase(defaultSuite.getSuiteName())) {
        throw new HdfsCompatIllegalArgumentException(
            "suite " + suiteClassName + " suiteName" +
                " conflicts with default suite " + defaultSuite.getSuiteName());
      }
    }
    if (!hasApiCase() && !hasShellCase()) {
      throw new HdfsCompatIllegalArgumentException(
          "suite " + suiteClassName + " is empty for both API and SHELL");
    }
  }

  private boolean hasApiCase() {
    return (suite.getApiCases() != null) &&
        (suite.getApiCases().length > 0);
  }

  private boolean hasShellCase() {
    return (suite.getShellCases() != null) &&
        (suite.getShellCases().length > 0);
  }

  @VisibleForTesting
  protected Map<String, HdfsCompatSuite> getDefaultSuites() {
    Map<String, HdfsCompatSuite> defaultSuites = new HashMap<>();
    defaultSuites.put("all", new HdfsCompatSuiteForAll());

View on GitHub (pinned to 2add963021)

Solutions

  1. Return at least one HdfsCompatApiCase or HdfsCompatShellCase, ideally from statically initialized arrays
  2. If the suite is intentionally API-only or shell-only, that is fine — only one side needs to be non-empty
  3. Verify the deployed jar is the build that contains the cases

Example fix

// before
@Override public HdfsCompatApiCase[] getApiCases() { return new HdfsCompatApiCase[0]; }
@Override public HdfsCompatShellCase[] getShellCases() { return null; }
// -> suite ... is empty for both API and SHELL

// after
@Override public HdfsCompatApiCase[] getApiCases() {
  return new HdfsCompatApiCase[]{ new MyListStatusCase(), new MyRenameCase() };
}
Defensive patterns

Strategy: validation

Validate before calling

HdfsCompatSuite s = (HdfsCompatSuite) Class.forName(cls).getConstructor().newInstance();
boolean hasCases = (s.getApiCases() != null && s.getApiCases().length > 0)
    || (s.getShellCases() != null && s.getShellCases().length > 0);
if (!hasCases) {
  throw new IllegalArgumentException(cls + " defines no API and no SHELL cases");
}

Prevention

When it happens

Trigger: A custom HdfsCompatSuite where getApiCases() and getShellCases() both return null or zero-length arrays — e.g. case classes written but never wired into the returned arrays, or case lists built conditionally and empty at runtime.

Common situations: Template suites with TODO placeholder arrays; refactoring that moved case classes but left getters returning the old empty arrays; deploying an early stub of the suite jar.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/676c7c06c0bf15d9. Report an issue: GitHub.