{"record":{"id":"c141c33f5109cb1f","repo":"hyperledger/fabric","slug":"block-data-is-empty","errorCode":null,"errorMessage":"Block data is empty","messagePattern":"Block data is empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gossip/privdata/coordinator.go","lineNumber":155,"sourceCode":") Coordinator {\n\treturn &coordinator{\n\t\tSupport:                        support,\n\t\tmspID:                          mspID,\n\t\tstore:                          store,\n\t\tselfSignedData:                 selfSignedData,\n\t\ttransientBlockRetention:        config.TransientBlockRetention,\n\t\tlogger:                         logger.With(\"channel\", support.ChainID),\n\t\tmetrics:                        metrics,\n\t\tpullRetryThreshold:             config.PullRetryThreshold,\n\t\tskipPullingInvalidTransactions: config.SkipPullingInvalidTransactions,\n\t\tidDeserializerFactory:          idDeserializerFactory,\n\t}\n}\n\n// StoreBlock stores block with private data into the ledger\nfunc (c *coordinator) StoreBlock(block *common.Block, privateDataSets util.PvtDataCollections) error {\n\tif block.Data == nil {\n\t\treturn errors.New(\"Block data is empty\")\n\t}\n\tif block.Header == nil {\n\t\treturn errors.New(\"Block header is nil\")\n\t}\n\n\tc.logger.Infof(\"Received block [%d] from buffer\", block.Header.Number)\n\n\tc.logger.Debugf(\"Validating block [%d]\", block.Header.Number)\n\n\tvalidationStart := time.Now()\n\terr := c.Validator.Validate(block)\n\tc.reportValidationDuration(time.Since(validationStart))\n\tif err != nil {\n\t\tc.logger.Errorf(\"Validation failed: %+v\", err)\n\t\treturn err\n\t}\n\n\tblockAndPvtData := &ledger.BlockAndPvtData{","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/gossip/privdata/coordinator.go#L137-L173","documentation":"coordinator.StoreBlock validates the incoming common.Block before committing it to the ledger and returns this error when block.Data is nil. A block without data payload cannot be validated or committed, so it is rejected immediately.","triggerScenarios":"Calling StoreBlock with a block whose Data field is nil — e.g. a malformed block fetched from gossip/orderer, a partially deserialized block, or a hand-constructed block in tests.","commonSituations":"Corrupted gossip transfer of blocks; orderer returning truncated blocks; off-chain ledger repair tooling feeding empty blocks; unit tests constructing common.Block without Data.","solutions":["Re-fetch the block from the orderer or a peer via block delivery/delclient","Discard or re-request the corrupted block from gossip source","Verify block deserialization (protoutil) succeeded before calling StoreBlock","In test/repair code, always populate block.Data before storing"],"exampleFix":"// before\ncoordinator.StoreBlock(&common.Block{}, nil)\n// after\nblk := &common.Block{Header: header, Data: &common.BlockData{Data: [][]byte{...}}}\nif blk.Data == nil || blk.Header == nil {\n    return errors.New(\"refusing to store incomplete block\")\n}\ncoordinator.StoreBlock(blk, pvtData)","handlingStrategy":"validation","validationCode":"if block == nil || block.Data == nil {\n    return errors.New(\"cannot store block: data is nil\")\n}\nif err := coordinator.StoreBlock(block, pvtData); err != nil { ... }","typeGuard":"func blockComplete(b *common.Block) bool {\n    return b != nil && b.Data != nil && b.Header != nil\n}","tryCatchPattern":null,"preventionTips":["Validate blocks (protoutil) before feeding them to the committer","Only source blocks from the orderer or validated peers","Check gossip block-fetch integrity on repeated failures","Populate Data and Header in test block fixtures"],"tags":["gossip","privdata","ledger","validation"],"backgroundTag":"malformed-block","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"}