{"record":{"id":"87cc58774a75f572","repo":"apache/hadoop","slug":"failed-to-validate-decoding","errorCode":null,"errorMessage":"Failed to validate decoding","messagePattern":"Failed to validate decoding","errorType":"exception","errorClass":"InvalidDecodingException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/DecodingValidator.java","lineNumber":122,"sourceCode":"          newErasedIndex = i;\n          newInputs[i] = null;\n          selected = true;\n        } else if (newInputs[i] == null) {\n          newInputs[i] = inputs[i];\n          if (inputs[i] != null) {\n            count++;\n          }\n        }\n      }\n\n      // Keep it for testing\n      newValidIndexes = CoderUtil.getValidIndexes(newInputs);\n\n      decoder.decode(newInputs, new int[]{newErasedIndex},\n          new ByteBuffer[]{buffer});\n\n      if (!buffer.equals(inputs[newErasedIndex])) {\n        throw new InvalidDecodingException(\"Failed to validate decoding\");\n      }\n    } finally {\n      toLimits(inputs);\n      resetBuffers(outputs);\n    }\n  }\n\n  /**\n   *  Validate outputs decoded from inputs, by decoding an input back from\n   *  those outputs and comparing it with the original one.\n   * @param inputs input buffers used for decoding\n   * @param erasedIndexes indexes of erased units used for decoding\n   * @param outputs decoded output buffers\n   * @throws IOException raised on errors performing I/O.\n   */\n  public void validate(ECChunk[] inputs, int[] erasedIndexes, ECChunk[] outputs)\n      throws IOException {\n    ByteBuffer[] newInputs = CoderUtil.toBuffers(inputs);","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/DecodingValidator.java#L104-L140","documentation":"Error \"Failed to validate decoding\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/DecodingValidator.java:122 when the library encounters an invalid state.","commonSituations":"Occurs when post-decode validation detects the recovered data does not match expectations, indicating a coding bug or bad inputs. Re-check inputs and coder configuration; do not ignore validation failures.","solutions":["Re-run with validation logging to find the mismatching block; the encoded/decoded data does not round-trip, indicating a coder bug or corrupt inputs.","Verify the raw coder implementation and its native library version match the expected codec."],"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-22T20:17:22.307Z"}