{"record":{"id":"82a0839de6ad73b2","repo":"hyperledger/fabric","slug":"failed-getting-a-new-bundle-from-envelope-of-confi","errorCode":null,"errorMessage":"failed getting a new bundle from envelope of config block","messagePattern":"failed getting a new bundle from envelope of config block","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/consensus/smartbft/util.go","lineNumber":289,"sourceCode":"\t\treturn nil, errors.WithMessage(err, \"error unmarshalling channel header\")\n\t}\n\n\treturn &request{\n\t\tchHdr:    chdr,\n\t\tsigHdr:   sigHdr,\n\t\tenvelope: envelope,\n\t}, nil\n}\n\n// remoteNodesFromConfigBlock unmarshalls the node config from the block metadata\nfunc remoteNodesFromConfigBlock(block *cb.Block, logger *flogging.FabricLogger, bccsp bccsp.BCCSP) (*nodeConfig, error) {\n\tenv := &cb.Envelope{}\n\tif err := proto.Unmarshal(block.Data.Data[0], env); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed unmarshalling envelope of config block\")\n\t}\n\tbundle, err := channelconfig.NewBundleFromEnvelope(env, bccsp)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed getting a new bundle from envelope of config block\")\n\t}\n\n\tchannelMSPs, err := bundle.MSPManager().GetMSPs()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed obtaining MSPs from MSPManager\")\n\t}\n\n\toc, ok := bundle.OrdererConfig()\n\tif !ok {\n\t\treturn nil, errors.New(\"no orderer config in config block\")\n\t}\n\n\t_, err = createSmartBftConfig(oc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar nodeIDs []uint64","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/consensus/smartbft/util.go#L271-L307","documentation":"In smartbft's remoteNodesFromConfigBlock, the genesis/config block's first envelope is unmarshalled into a cb.Envelope and then passed to channelconfig.NewBundleFromEnvelope, which validates the channel configuration and builds a config bundle. This error is a wrap of the underlying NewBundleFromEnvelope failure, meaning the config envelope is not valid channel configuration (bad payload, missing Channel header, or invalid ConfigGroup structure). It aborts building the SmartBFT cluster metadata after a config block commit.","triggerScenarios":"configBlockCommitted -> remoteNodesFromConfigBlock with a block whose Data.Data[0] is an envelope that fails channelconfig.NewBundleFromEnvelope: config envelope not extractable, payload type not CONFIG, ConfigGroup missing Channel/Orderer groups, or malformed nested config values.","commonSituations":"Hand-crafting or mutating a config block (e.g. via configtxlator round-trips gone wrong); committing a block whose first envelope is not a config transaction (e.g. a normal tx at index 0); corrupted block storage; blocks produced by a different Fabric version with incompatible config schemas.","solutions":["Inspect the underlying wrapped error in the log to identify whether unmarshalling, payload extraction, or config validation failed","Verify the block's first envelope is a config transaction (Header type = CONFIG) using protoutil.EnvelopeToPayload / configtx filter","Regenerate the config block with configtxgen/configtxlator matching your Fabric version instead of manually editing it","Check that all peer/orderer binaries and channel config version are compatible (config schema changes between releases)","If block storage is suspect, repair the node by re-fetching the channel genesis/config block from a healthy orderer or re-join the channel"],"exampleFix":"// before: committing a block with a non-config envelope at index 0\nblock.Data.Data[0] = normalTxEnvelopeBytes\n\n// after: ensure index 0 is the CONFIG envelope (e.g. re-created via configtxgen/configtxlator)\nconfigEnv := protoutil.MarshalOrPanic(&cb.Envelope{Payload: configPayloadBytes})\nblock.Data.Data = [][]byte{configEnv}","handlingStrategy":"validation","validationCode":"env := &cb.Envelope{}\nif err := proto.Unmarshal(block.Data.Data[0], env); err != nil {\n    return fmt.Errorf(\"block %d: first envelope not unmarshallable: %w\", block.Header.Number, err)\n}\npayload, err := protoutil.UnmarshalPayload(env.Payload)\nif err != nil {\n    return fmt.Errorf(\"envelope payload invalid: %w\", err)\n}\nchdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)\nif err != nil || chdr.Type != int32(cb.HeaderType_CONFIG) {\n    return fmt.Errorf(\"first envelope is not a CONFIG transaction (type=%d)\", chdr.Type)\n}\n// only then call into consensus / configBlockCommitted","typeGuard":"func isConfigBlock(block *cb.Block) bool {\n    if block == nil || len(block.Data.Data) == 0 {\n        return false\n    }\n    env := &cb.Envelope{}\n    if proto.Unmarshal(block.Data.Data[0], env) != nil {\n        return false\n    }\n    payload, err := protoutil.UnmarshalPayload(env.Payload)\n    if err != nil || payload.Header == nil {\n        return false\n    }\n    chdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)\n    return err == nil && chdr.Type == int32(cb.HeaderType_CONFIG)\n}","tryCatchPattern":"block, err := ledger.GetConfigBlock()\nif err != nil {\n    return fmt.Errorf(\"cannot read config block: %w\", err)\n}\nif !isConfigBlock(block) {\n    return errors.New(\"retrieved block is not a valid config block; regenerate genesis block via configtxgen\")\n}","preventionTips":["Always generate genesis/config blocks with configtxgen for the matching Fabric version; never hand-edit block bytes","After configtxlator round-trips, recompute and validate the envelope before committing","Log the channelID and block number in configBlockCommitted paths to catch wrong-channel blocks early","Verify block storage integrity (fileLedger) when nodes are cloned or restored from snapshots"],"tags":["hyperledger-fabric","orderer","config-block","smartbft"],"backgroundTag":"invalid-channel-config","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"}