{"record":{"id":"ecd3f9db54338121","repo":"hyperledger/fabric","slug":"missing-block-header","errorCode":null,"errorMessage":"missing block header","messagePattern":"missing block header","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/cluster/util.go","lineNumber":224,"sourceCode":"\n// BlockSequenceVerifier verifies that the given consecutive sequence\n// of blocks is valid.\ntype 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 {","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/cluster/util.go#L206-L242","documentation":"VerifyBlockHash found that the block at indexInBuffer has a nil Header. A common.Block must carry a Header (number, previous hash, data hash) for hash-chain verification; a headerless block cannot be validated. Fabric normally never persists headerless blocks, so this usually indicates uninitialized or corrupt in-memory block data.","triggerScenarios":"A caller passes a partially initialized common.Block (Header nil) into the blockBuff given to VerifyBlockHash, e.g. a failed unmarshal producing a zero-value block, or a buffer slot never filled.","commonSituations":"Deserialization failures when pulling blocks during onboarding/catch-up; bugs in test harnesses constructing blocks manually; data corruption from a malfunctioning storage layer.","solutions":["Check the code path that produced the block for unmarshal errors (protoutil.UnmarshalBlock) that were ignored or swallowed.","Validate blocks before verification: skip/log any with nil Header instead of passing them to VerifyBlockHash.","If blocks come from disk, verify file/block-store integrity and consider re-replicating the block from another orderer."],"exampleFix":"// before\nblockBuff = append(blockBuff, block) // block may be zero-value on unmarshal error\n// after\nif block == nil || block.Header == nil {\n    return errors.New(\"received block with missing header, skipping\")\n}\nblockBuff = append(blockBuff, block)","handlingStrategy":"validation","validationCode":"if b == nil || b.Header == nil {\n    return errors.New(\"cannot verify block: header is missing\")\n}\n// safe to call cluster.VerifyBlockHash now","typeGuard":"func hasVerifiableHeader(b *common.Block) bool {\n    return b != nil && b.Header != nil\n}","tryCatchPattern":null,"preventionTips":["Never ignore errors from protoutil.UnmarshalBlock when constructing blocks.","Zero-value common.Block structs are invalid — populate Header and Data before use.","Reject headerless blocks at the ingestion boundary of your puller."],"tags":["blockchain","block-verification","data-integrity"],"backgroundTag":"missing-block-header","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"}