{"record":{"id":"130c6d6867d26e02","repo":"apache/hadoop","slug":"invalid-numdataunits-and-numparityunits-130c6d","errorCode":null,"errorMessage":"Invalid numDataUnits and numParityUnits","messagePattern":"Invalid numDataUnits and numParityUnits","errorType":"exception","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoder.java","lineNumber":46,"sourceCode":" * isn't available in some environment. Please always use native implementations\n * when possible. This new Java coder is about 5X faster than the one originated\n * from HDFS-RAID, and also compatible with the native/ISA-L coder.\n */\n@InterfaceAudience.Private\npublic class RSRawEncoder extends RawErasureEncoder {\n  // relevant to schema and won't change during encode calls.\n  private byte[] encodeMatrix;\n  /**\n   * Array of input tables generated from coding coefficients previously.\n   * Must be of size 32*k*rows\n   */\n  private byte[] gfTables;\n\n  public RSRawEncoder(ErasureCoderOptions coderOptions) {\n    super(coderOptions);\n\n    if (getNumAllUnits() >= RSUtil.GF.getFieldSize()) {\n      throw new HadoopIllegalArgumentException(\n          \"Invalid numDataUnits and numParityUnits\");\n    }\n\n    encodeMatrix = new byte[getNumAllUnits() * getNumDataUnits()];\n    RSUtil.genCauchyMatrix(encodeMatrix, getNumAllUnits(), getNumDataUnits());\n    if (allowVerboseDump()) {\n      DumpUtil.dumpMatrix(encodeMatrix, getNumDataUnits(), getNumAllUnits());\n    }\n    gfTables = new byte[getNumAllUnits() * getNumDataUnits() * 32];\n    RSUtil.initTables(getNumDataUnits(), getNumParityUnits(), encodeMatrix,\n        getNumDataUnits() * getNumDataUnits(), gfTables);\n    if (allowVerboseDump()) {\n      System.out.println(DumpUtil.bytesToHex(gfTables, -1));\n    }\n  }\n\n  @Override\n  protected void doEncode(ByteBufferEncodingState encodingState) {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoder.java#L28-L64","documentation":"Error \"Invalid numDataUnits and numParityUnits\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoder.java:46 when the library encounters an invalid state.","commonSituations":"Occurs when RSRawEncoder is created with invalid numDataUnits/numParityUnits values. Configure valid RS codec unit counts before creating the encoder.","solutions":["Correct the numDataUnits/numParityUnits in the EC schema to values supported by the RS encoder."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}