{"record":{"id":"7153f6c501732234","repo":"apache/hadoop","slug":"invalid-checksum-length-received-length-is-but","errorCode":null,"errorMessage":"Invalid checksum length: received length is {} but expected length is {}","messagePattern":"Invalid checksum length: received length is (.+?) but expected length is (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java","lineNumber":655,"sourceCode":"    }\n    \n    ByteBuffer dataBuf = packetReceiver.getDataSlice();\n    ByteBuffer checksumBuf = packetReceiver.getChecksumSlice();\n    \n    if (lastPacketInBlock || len == 0) {\n      if(LOG.isDebugEnabled()) {\n        LOG.debug(\"Receiving an empty packet or the end of the block \" + block);\n      }\n      // sync block if requested\n      if (syncBlock) {\n        flushOrSync(true, seqno);\n      }\n    } else {\n      final int checksumLen = diskChecksum.getChecksumSize(len);\n      final int checksumReceivedLen = checksumBuf.capacity();\n\n      if (checksumReceivedLen > 0 && checksumReceivedLen != checksumLen) {\n        throw new IOException(\"Invalid checksum length: received length is \"\n            + checksumReceivedLen + \" but expected length is \" + checksumLen);\n      }\n\n      if (checksumReceivedLen > 0 && shouldVerifyChecksum()) {\n        try {\n          verifyChunks(dataBuf, checksumBuf);\n        } catch (IOException ioe) {\n          // checksum error detected locally. there is no reason to continue.\n          if (responder != null) {\n            try {\n              ((PacketResponder) responder.getRunnable()).enqueue(seqno,\n                  lastPacketInBlock, offsetInBlock,\n                  Status.ERROR_CHECKSUM);\n              // Wait until the responder sends back the response\n              // and interrupt this thread.\n              Thread.sleep(3000);\n            } catch (InterruptedException e) { }\n          }","sourceCodeStart":637,"sourceCodeEnd":673,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java#L637-L673","documentation":"Error \"Invalid checksum length: received length is {} but expected length is {}\" thrown in apache/hadoop.","triggerScenarios":"The checksum byte array received with a packet has a length different from what the DataNode computed for the packet's data chunks.","commonSituations":"The checksum section of a packet had a length different from the configured checksum size. Confirm matching checksum configuration between client and cluster.","solutions":["Confirm the client uses the same checksum type and bytes-per-checksum as the block/pipeline expects (dfs.checksum.type, dfs.bytes-per-checksum).","Check for version-skew between client and DataNode producing a checksum buffer of unexpected size."],"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"}