{"record":{"id":"4214afccdab728a0","repo":"hyperledger/fabric","slug":"failed-extracting-envelope-from-block","errorCode":null,"errorMessage":"failed extracting envelope from block","messagePattern":"failed extracting envelope from block","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/server/util.go","lineNumber":54,"sourceCode":"\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}\n\ntype clock struct{}\n\nfunc (c *clock) Now() time.Time {\n\treturn time.Now()","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/server/util.go#L36-L72","documentation":"After confirming the block has data, validateBootstrapBlock unmarshals the first envelope from block.Data.Data[0] as a common.Envelope. If protobuf unmarshaling fails, the block bytes are not a valid Fabric envelope and the error is wrapped as 'failed extracting envelope from block'.","triggerScenarios":"'osnadmin channel join' (or verifyNoSystemChannel paths) given a config block whose first payload cannot be proto-unmarshaled into common.Envelope — corrupted bytes, wrong file format, or a block from an incompatible version.","commonSituations":"Using a block file produced by a different tool/format, copying a block over the network with corruption, accidentally passing a PEM cert, tarball, or JSON config as the --config-block.","solutions":["Regenerate the block with the same Fabric version's configtxgen and retry the join","Validate the block with 'configtxgen -inspectBlock' or 'configtxlator decode' to confirm it parses","Re-transfer the block file and compare checksums to rule out corruption","Ensure osnadmin and orderer binaries come from the same Fabric release"],"exampleFix":"// before\nosnadmin channel join --channelID mychannel --config-block channel.json\n// after\nconfigtxgen -profile TwoOrgsChannel -outputBlock /tmp/genesis.block -channelID mychannel\nosnadmin channel join --channelID mychannel --config-block /tmp/genesis.block","handlingStrategy":"validation","validationCode":"env := &common.Envelope{}\nif err := proto.Unmarshal(block.Data.Data[0], env); err != nil {\n    return fmt.Errorf(\"config block is not a valid Fabric envelope: %w\", err)\n}","typeGuard":"func isParseableEnvelope(b *common.Block) error {\n    if b == nil || b.Data == nil || len(b.Data.Data) == 0 {\n        return errors.New(\"no block data\")\n    }\n    e := &common.Envelope{}\n    return proto.Unmarshal(b.Data.Data[0], e)\n}","tryCatchPattern":null,"preventionTips":["Validate the block with configtxlator/configtxgen before joining","Re-transfer files with checksum verification","Keep osnadmin and orderer on the same Fabric release"],"tags":["fabric","orderer","protobuf","channel-participation","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"}