apache/hadoop · error · IllegalArgumentException

No schema options are provided

Error message

No schema options are provided

What it means

ECSchema's map-based constructor rejects a null or empty options map with IllegalArgumentException. An ECSchema must carry at least the codec name and the data/parity unit counts, so an empty map cannot describe a usable erasure-coding schema and fails fast during construction.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/ECSchema.java:71

  /**
   * Number of parity units generated in a coding
   */
  private final int numParityUnits;

  /*
   * An erasure code can have its own specific advanced parameters, subject to
   * itself to interpret these key-value settings.
   */
  private final Map<String, String> extraOptions;

  /**
   * Constructor with schema name and provided all options. Note the options may
   * contain additional information for the erasure codec to interpret further.
   * @param allOptions all schema options
   */
  public ECSchema(Map<String, String> allOptions) {
    if (allOptions == null || allOptions.isEmpty()) {
      throw new IllegalArgumentException("No schema options are provided");
    }

    this.codecName = allOptions.get(CODEC_NAME_KEY);
    if (codecName == null || codecName.isEmpty()) {
      throw new IllegalArgumentException("No codec option is provided");
    }

    int tmpNumDataUnits = extractIntOption(NUM_DATA_UNITS_KEY, allOptions);
    int tmpNumParityUnits = extractIntOption(NUM_PARITY_UNITS_KEY, allOptions);
    if (tmpNumDataUnits < 0 || tmpNumParityUnits < 0) {
      throw new IllegalArgumentException(
          "No good option for numDataUnits or numParityUnits found ");
    }
    this.numDataUnits = tmpNumDataUnits;
    this.numParityUnits = tmpNumParityUnits;

    allOptions.remove(CODEC_NAME_KEY);
    allOptions.remove(NUM_DATA_UNITS_KEY);

View on GitHub (pinned to 2add963021)

Solutions

  1. Pass a non-empty map containing at least the keys "codec", "numDataUnits", and "numParityUnits" (values as strings)
  2. If the map comes from a policy file, inspect the <schema> section of that policy and confirm its options are present and parsed into the map
  3. For programmatic schemas, prefer the convenience constructor new ECSchema(codecName, numDataUnits, numParityUnits) which cannot hit this error

Example fix

// before
Map<String, String> options = Collections.emptyMap();
ECSchema schema = new ECSchema(options); // throws

// after
Map<String, String> options = new HashMap<>();
options.put(ECSchema.CODEC_NAME_KEY, "rs"); // key "codec"
options.put(ECSchema.NUM_DATA_UNITS_KEY, "6");
options.put(ECSchema.NUM_PARITY_UNITS_KEY, "3");
ECSchema schema = new ECSchema(options);
Defensive patterns

Strategy: validation

Validate before calling

if (allOptions == null || allOptions.isEmpty()) {
  throw new IllegalArgumentException(
      "EC schema options missing: expected codec, numDataUnits, numParityUnits");
}
ECSchema schema = new ECSchema(allOptions);

Try / catch

try {
  return new ECSchema(allOptions);
} catch (IllegalArgumentException e) {
  throw new IllegalArgumentException("Invalid EC schema in policy "
      + policyName + ": " + e.getMessage(), e); // add policy context
}

Prevention

When it happens

Trigger: Calling new ECSchema(null) or new ECSchema(new HashMap<>()); in practice the empty map usually comes from deserializing a user-defined EC policy (e.g., an ec-policy.xml entry whose <schema> section is missing or whose options failed to parse) or from building the options map on a code path that never populated it.

Common situations: Hand-written EC policy XML with a missing or empty schema section; schema maps built from client payloads or JSON that dropped all keys; copy-pasting policy definitions between systems and losing the options block.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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