apache/hadoop · error · HadoopIllegalArgumentException
Invalid buffer, isDirect should be
Error message
Invalid buffer, isDirect should be {} What it means
ByteBufferEncodingState.checkBuffers compares buffer.isDirect() against the configured usingDirectBuffer; a mismatch means the caller mixed heap and direct buffers (or chose the wrong API), and the native/raw coder requires uniform buffer types.
Solutions
- Use direct ByteBuffers when the encoder's preferDirectBuffer() is true, heap buffers otherwise; make all buffers consistent.
Defensive patterns
Strategy: validation
When it happens
Trigger: 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.
Common situations: Occurs when an encoding buffer's directness does not match the coder's expectation. Allocate direct or heap ByteBuffers consistent with the coder configuration.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/5b0bc1506a069edf.
Report an issue: GitHub.
Appendix: source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/ByteBufferEncodingState.java:103
/**
* Check and ensure the buffers are of the desired length and type, direct
* buffers or not.
* @param buffers the buffers to check
*/
void checkBuffers(ByteBuffer[] buffers) {
for (ByteBuffer buffer : buffers) {
if (buffer == null) {
throw new HadoopIllegalArgumentException(
"Invalid buffer found, not allowing null");
}
if (buffer.remaining() != encodeLength) {
throw new HadoopIllegalArgumentException(
"Invalid buffer, not of length " + encodeLength);
}
if (buffer.isDirect() != usingDirectBuffer) {
throw new HadoopIllegalArgumentException(
"Invalid buffer, isDirect should be " + usingDirectBuffer);
}
}
}
}
View on GitHub (pinned to 2add963021)