{"record":{"id":"ba2a5cce7cf4a6c5","repo":"hyperledger/fabric","slug":"missing-block-data","errorCode":null,"errorMessage":"missing block data","messagePattern":"missing block data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/cluster/util.go","lineNumber":227,"sourceCode":"type BlockSequenceVerifier func(blocks []*common.Block, channel string) error\n\n// Dialer creates a gRPC connection to a remote address\ntype Dialer interface {\n\tDial(endpointCriteria EndpointCriteria) (*grpc.ClientConn, error)\n}\n\n// VerifyBlockHash verifies the hash chain of the block with the given index\n// among the blocks of the given block buffer.\nfunc VerifyBlockHash(indexInBuffer int, blockBuff []*common.Block) error {\n\tif len(blockBuff) <= indexInBuffer {\n\t\treturn errors.Errorf(\"index %d out of bounds (total %d blocks)\", indexInBuffer, len(blockBuff))\n\t}\n\tblock := blockBuff[indexInBuffer]\n\tif block.Header == nil {\n\t\treturn errors.New(\"missing block header\")\n\t}\n\tif block.Data == nil {\n\t\treturn errors.New(\"missing block data\")\n\t}\n\tseq := block.Header.Number\n\tdataHash, err := protoutil.BlockDataHash(block.Data)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Verify data hash matches the hash in the header\n\tif !bytes.Equal(dataHash, block.Header.DataHash) {\n\t\tcomputedHash := hex.EncodeToString(dataHash)\n\t\tclaimedHash := hex.EncodeToString(block.Header.DataHash)\n\t\treturn errors.Errorf(\"computed hash of block (%d) (%s) doesn't match claimed hash (%s)\",\n\t\t\tseq, computedHash, claimedHash)\n\t}\n\t// We have a previous block in the buffer, ensure current block's previous hash matches the previous one.\n\tif indexInBuffer > 0 {\n\t\tprevBlock := blockBuff[indexInBuffer-1]\n\t\tcurrSeq := block.Header.Number\n\t\tif prevBlock.Header == nil {","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/cluster/util.go#L209-L245","documentation":"VerifyBlockHash found that the block at indexInBuffer has a nil Data field. Without the block's payload, protoutil.BlockDataHash cannot compute the data hash to compare against the header, so verification aborts. Like the missing-header error, it indicates uninitialized or corrupt block data rather than a hash mismatch.","triggerScenarios":"A common.Block is placed into blockBuff with Header set but Data nil — typically from a truncated/garbled unmarshal during block pull, or from manually constructed blocks in tests/benchmarks.","commonSituations":"Interrupted block replication delivering partial payloads; corrupted file ledger entries; test code building common.Block structs without populating Data.","solutions":["Inspect the producer of the block for swallowed unmarshal/partial-read errors and fail fast on them.","Pre-validate blocks (nil Header and Data checks) before pushing into the buffer used by VerifyBlockHash.","Re-pull the affected blocks from a healthy orderer; if corruption persists, check ledger storage health (fileLedger/blockStore)."],"exampleFix":"// before\nseq := block.Header.Number\ndataHash, _ := protoutil.BlockDataHash(block.Data)\n// after\nif block.Data == nil {\n    return errors.New(\"block data is missing, cannot verify hash\")\n}\ndataHash, err := protoutil.BlockDataHash(block.Data)\nif err != nil {\n    return err\n}","handlingStrategy":"validation","validationCode":"if b == nil || b.Header == nil || b.Data == nil {\n    return errors.New(\"cannot verify block: header or data missing\")\n}\n// safe to call cluster.VerifyBlockHash now","typeGuard":"func isCompleteBlock(b *common.Block) bool {\n    return b != nil && b.Header != nil && b.Data != nil\n}","tryCatchPattern":null,"preventionTips":["Check unmarshal and partial-read errors when receiving blocks over the wire.","Only append fully populated blocks (Header and Data set) to buffers used for verification.","Investigate storage health if incomplete blocks recur from the local ledger."],"tags":["blockchain","block-verification","data-integrity"],"backgroundTag":"missing-block-data","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}