{"record":{"id":"81a21b989885da27","repo":"hyperledger/fabric","slug":"empty-block-data","errorCode":null,"errorMessage":"empty block data","messagePattern":"empty block data","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/server/util.go","lineNumber":49,"sourceCode":"\t}\n\n\tlogger.Debug(\"Ledger dir:\", ld)\n\tlf, err := fileledger.New(ld, metricsProvider)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"Error in opening ledger factory\")\n\t}\n\treturn lf, nil\n}\n\n// validateBootstrapBlock returns whether this block can be used as a bootstrap block.\n// A bootstrap block is a block of a system channel, and needs to have a ConsortiumsConfig.\nfunc validateBootstrapBlock(block *common.Block, bccsp bccsp.BCCSP) error {\n\tif block == nil {\n\t\treturn errors.New(\"nil block\")\n\t}\n\n\tif block.Data == nil || len(block.Data.Data) == 0 {\n\t\treturn errors.New(\"empty block data\")\n\t}\n\n\tfirstTransaction := &common.Envelope{}\n\tif err := proto.Unmarshal(block.Data.Data[0], firstTransaction); err != nil {\n\t\treturn errors.Wrap(err, \"failed extracting envelope from block\")\n\t}\n\n\tbundle, err := channelconfig.NewBundleFromEnvelope(firstTransaction, bccsp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, exists := bundle.ConsortiumsConfig()\n\tif !exists {\n\t\treturn errors.New(\"the block isn't a system channel block because it lacks ConsortiumsConfig\")\n\t}\n\treturn nil\n}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/server/util.go#L31-L67","documentation":"validateBootstrapBlock checks a genesis/bootstrap block passed to channel participation. If the block has no Data field or the Data.Data slice is empty, there is no envelope to inspect, so the orderer rejects it with 'empty block data'. It guards against joining a channel with a malformed or truncated config block.","triggerScenarios":"Calling 'osnadmin channel join' with a genesis/config block file whose Data section is nil or whose Data.Data array is empty — typically an empty, zero-byte-serialized, or wrongly generated block file.","commonSituations":"Generating a genesis block with a broken configtxgen invocation or wrong profile; pointing osnadmin at an empty file or a file that is not a protobuf block (e.g. a tarball or JSON); truncation during file transfer.","solutions":["Regenerate the config block with 'configtxgen -profile <profile> -outputBlock <file> -channelID <channel>' and verify it is non-empty","Confirm the file passed to 'osnadmin channel join --channel-config' is the actual block file, not a tarball/genesis.json","Check the block is readable and uncorrupted (e.g. inspect with 'configtxgen -inspectBlock' or 'configtxlator')","Upgrade tooling/version mismatch: ensure the client and orderer use compatible block serialization"],"exampleFix":"// before\nosnadmin channel join --channelID mychannel --config-block /tmp/empty.block\n// after\nconfigtxgen -profile TwoOrgsChannel -outputBlock /tmp/genesis.block -channelID mychannel\nosnadmin channel join --channelID mychannel --config-block /tmp/genesis.block","handlingStrategy":"validation","validationCode":"block, err := readBlockFile(path)\nif err != nil { return err }\nif block.Data == nil || len(block.Data.Data) == 0 {\n    return fmt.Errorf(\"config block %s has no data; regenerate it with configtxgen\", path)\n}","typeGuard":"func hasBlockData(b *common.Block) bool {\n    return b != nil && b.Data != nil && len(b.Data.Data) > 0\n}","tryCatchPattern":null,"preventionTips":["Regenerate blocks with configtxgen from the same Fabric version as the orderer","Sanity-check block files with 'configtxgen -inspectBlock' before joining","Never pass empty/placeholder files to --config-block; verify file size > 0"],"tags":["fabric","orderer","channel-participation","genesis-block","malformed-input"],"backgroundTag":"invalid-genesis-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"}