{"record":{"id":"85c1eef5b5885af1","repo":"apache/hadoop","slug":"no-schema-options-are-provided","errorCode":null,"errorMessage":"No schema options are provided","messagePattern":"No schema options are provided","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/ECSchema.java","lineNumber":71,"sourceCode":"  /**\n   * Number of parity units generated in a coding\n   */\n  private final int numParityUnits;\n\n  /*\n   * An erasure code can have its own specific advanced parameters, subject to\n   * itself to interpret these key-value settings.\n   */\n  private final Map<String, String> extraOptions;\n\n  /**\n   * Constructor with schema name and provided all options. Note the options may\n   * contain additional information for the erasure codec to interpret further.\n   * @param allOptions all schema options\n   */\n  public ECSchema(Map<String, String> allOptions) {\n    if (allOptions == null || allOptions.isEmpty()) {\n      throw new IllegalArgumentException(\"No schema options are provided\");\n    }\n\n    this.codecName = allOptions.get(CODEC_NAME_KEY);\n    if (codecName == null || codecName.isEmpty()) {\n      throw new IllegalArgumentException(\"No codec option is provided\");\n    }\n\n    int tmpNumDataUnits = extractIntOption(NUM_DATA_UNITS_KEY, allOptions);\n    int tmpNumParityUnits = extractIntOption(NUM_PARITY_UNITS_KEY, allOptions);\n    if (tmpNumDataUnits < 0 || tmpNumParityUnits < 0) {\n      throw new IllegalArgumentException(\n          \"No good option for numDataUnits or numParityUnits found \");\n    }\n    this.numDataUnits = tmpNumDataUnits;\n    this.numParityUnits = tmpNumParityUnits;\n\n    allOptions.remove(CODEC_NAME_KEY);\n    allOptions.remove(NUM_DATA_UNITS_KEY);","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/ECSchema.java#L53-L89","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a non-empty map containing at least the keys \"codec\", \"numDataUnits\", and \"numParityUnits\" (values as strings)","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","For programmatic schemas, prefer the convenience constructor new ECSchema(codecName, numDataUnits, numParityUnits) which cannot hit this error"],"exampleFix":"// before\nMap<String, String> options = Collections.emptyMap();\nECSchema schema = new ECSchema(options); // throws\n\n// after\nMap<String, String> options = new HashMap<>();\noptions.put(ECSchema.CODEC_NAME_KEY, \"rs\"); // key \"codec\"\noptions.put(ECSchema.NUM_DATA_UNITS_KEY, \"6\");\noptions.put(ECSchema.NUM_PARITY_UNITS_KEY, \"3\");\nECSchema schema = new ECSchema(options);","handlingStrategy":"validation","validationCode":"if (allOptions == null || allOptions.isEmpty()) {\n  throw new IllegalArgumentException(\n      \"EC schema options missing: expected codec, numDataUnits, numParityUnits\");\n}\nECSchema schema = new ECSchema(allOptions);","typeGuard":null,"tryCatchPattern":"try {\n  return new ECSchema(allOptions);\n} catch (IllegalArgumentException e) {\n  throw new IllegalArgumentException(\"Invalid EC schema in policy \"\n      + policyName + \": \" + e.getMessage(), e); // add policy context\n}","preventionTips":["Build schemas programmatically with new ECSchema(codec, numData, numParity) instead of hand-assembled maps","Never construct ECSchema from unvalidated external payloads; check the map is non-empty first","Log the raw options map when schema parsing fails so the offending policy entry is identifiable"],"tags":["erasure-coding","schema","validation","hadoop-common"],"backgroundTag":"schema-validation-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}