{"record":{"id":"5b0bc1506a069edf","repo":"apache/hadoop","slug":"invalid-buffer-isdirect-should-be-5b0bc1","errorCode":null,"errorMessage":"Invalid buffer, isDirect should be {}","messagePattern":"Invalid buffer, isDirect should be (.+?)","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":103,"sourceCode":"\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":85,"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#L85-L109","documentation":"Error \"Invalid buffer, isDirect should be {}\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/ByteBufferEncodingState.java:103 when the library encounters an invalid state.","commonSituations":"Occurs when an encoding buffer's directness does not match the coder's expectation. Allocate direct or heap ByteBuffers consistent with the coder configuration.","solutions":["Use direct ByteBuffers when the encoder's preferDirectBuffer() is true, heap buffers otherwise; make all buffers consistent."],"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"}