{"record":{"id":"910a7ad2e5691384","repo":"apache/hadoop","slug":"invalid-buffer-not-of-length-910a7a","errorCode":null,"errorMessage":"Invalid buffer not of length {}","messagePattern":"Invalid buffer not of length (.+?)","errorType":"exception","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/ByteBufferEncodingState.java","lineNumber":99,"sourceCode":"    ByteArrayEncodingState baeState = new ByteArrayEncodingState(encoder,\n        encodeLength, newInputs, inputOffsets, newOutputs, outputOffsets);\n    return baeState;\n  }\n\n  /**\n   * Check and ensure the buffers are of the desired length and type, direct\n   * buffers or not.\n   * @param buffers the buffers to check\n   */\n  void checkBuffers(ByteBuffer[] buffers) {\n    for (ByteBuffer buffer : buffers) {\n      if (buffer == null) {\n        throw new HadoopIllegalArgumentException(\n            \"Invalid buffer found, not allowing null\");\n      }\n\n      if (buffer.remaining() != encodeLength) {\n        throw new HadoopIllegalArgumentException(\n            \"Invalid buffer, not of length \" + encodeLength);\n      }\n      if (buffer.isDirect() != usingDirectBuffer) {\n        throw new HadoopIllegalArgumentException(\n            \"Invalid buffer, isDirect should be \" + usingDirectBuffer);\n      }\n    }\n  }\n}\n","sourceCodeStart":81,"sourceCodeEnd":109,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/ByteBufferEncodingState.java#L81-L109","documentation":"Error \"Invalid buffer not of length {}\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/ByteBufferEncodingState.java:99 when the library encounters an invalid state.","commonSituations":"Occurs when an encoding buffer's length does not match the expected unit length. Size all buffers to the schema's unit length before encoding.","solutions":["Size every input/output buffer to exactly the expected block length reported by the coder.","Reuse a uniform bufferSize from the coder options when allocating buffers."],"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"}