{"record":{"id":"fe51f81ab16badac","repo":"apache/hadoop","slug":"unexpected-packet-data-length-for-from-a-pa","errorCode":null,"errorMessage":"Unexpected packet data length for {} from {}: a partial chunk must be sent in an individual packet (data length = {} > bytesPerChecksum = {})","messagePattern":"Unexpected packet data length for (.+?) from (.+?): a partial chunk must be sent in an individual packet \\(data length = (.+?) > bytesPerChecksum = (.+?)\\)","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":726,"sourceCode":"          boolean alignedOnDisk = partialChunkSizeOnDisk == 0;\n          boolean alignedInPacket = firstByteInBlock % bytesPerChecksum == 0;\n\n          // If the end of the on-disk data is not chunk-aligned, the last\n          // checksum needs to be overwritten.\n          boolean overwriteLastCrc = !alignedOnDisk && !shouldNotWriteChecksum;\n          // If the starting offset of the packat data is at the last chunk\n          // boundary of the data on disk, the partial checksum recalculation\n          // can be skipped and the checksum supplied by the client can be used\n          // instead. This reduces disk reads and cpu load.\n          boolean doCrcRecalc = overwriteLastCrc &&\n              (lastChunkBoundary != firstByteInBlock);\n\n          // If this is a partial chunk, then verify that this is the only\n          // chunk in the packet. If the starting offset is not chunk\n          // aligned, the packet should terminate at or before the next\n          // chunk boundary.\n          if (!alignedInPacket && len > bytesPerChecksum) {\n            throw new IOException(\"Unexpected packet data length for \"\n                +  block + \" from \" + inAddr + \": a partial chunk must be \"\n                + \" sent in an individual packet (data length = \" + len\n                +  \" > bytesPerChecksum = \" + bytesPerChecksum + \")\");\n          }\n\n          // If the last portion of the block file is not a full chunk,\n          // then read in pre-existing partial data chunk and recalculate\n          // the checksum so that the checksum calculation can continue\n          // from the right state. If the client provided the checksum for\n          // the whole chunk, this is not necessary.\n          Checksum partialCrc = null;\n          if (doCrcRecalc) {\n            if (LOG.isDebugEnabled()) {\n              LOG.debug(\"receivePacket for \" + block \n                  + \": previous write did not end at the chunk boundary.\"\n                  + \" onDiskLen=\" + onDiskLen);\n            }\n            long offsetInChecksum = BlockMetadataHeader.getHeaderSize() +","sourceCodeStart":708,"sourceCodeEnd":744,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java#L708-L744","documentation":"Error \"Unexpected packet data length for {} from {}: a partial chunk must be sent in an individual packet (data length = {} > bytesPerChecksum = {})\" thrown in apache/hadoop.","triggerScenarios":"A packet's data length exceeds one bytesPerChecksum unit while containing a partial chunk, violating the rule that partial chunks are sent in individual packets.","commonSituations":"A packet carried a partial chunk larger than bytesPerChecksum, which the protocol forbids. Usually caused by mismatched client/server chunk size settings.","solutions":["Ensure the client sends a partial final chunk as its own packet rather than coalescing it with other data; upgrade clients with this bug.","Verify client/DataNode version compatibility; this is a protocol-level violation by the sender."],"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"}