hyperledger/fabric · error
failed extracting bundle from envelope
Error message
failed extracting bundle from envelope
What it means
EndpointconfigFromConfigBlock parses the config block envelope into a channelconfig bundle (which contains the channel's organizations, MSPs, and orderer configuration). This error wraps any failure returned by channelconfig.NewBundleFromEnvelope — the envelope inside the block could not be interpreted as a valid channel configuration (bad proto, not a config transaction, unsupported structure). The wrap message adds context that the bundle extraction step specifically failed.
Source
Thrown at orderer/common/cluster/util.go:327
}
return string(rawJSON)
}
// EndpointconfigFromConfigBlock retrieves TLS CA certificates and endpoints
// from a config block.
func EndpointconfigFromConfigBlock(block *common.Block, bccsp bccsp.BCCSP) ([]EndpointCriteria, error) {
if block == nil {
return nil, errors.New("nil block")
}
envelopeConfig, err := protoutil.ExtractEnvelope(block, 0)
if err != nil {
return nil, err
}
bundle, err := channelconfig.NewBundleFromEnvelope(envelopeConfig, bccsp)
if err != nil {
return nil, errors.Wrap(err, "failed extracting bundle from envelope")
}
msps, err := bundle.MSPManager().GetMSPs()
if err != nil {
return nil, errors.Wrap(err, "failed obtaining MSPs from MSPManager")
}
ordererConfig, ok := bundle.OrdererConfig()
if !ok {
return nil, errors.New("failed obtaining orderer config from bundle")
}
mspIDsToCACerts := make(map[string][][]byte)
var aggregatedTLSCerts [][]byte
for _, org := range ordererConfig.Organizations() {
// Validate that every orderer org has a corresponding MSP instance in the MSP Manager.
msp, exists := msps[org.MSPID()]
if !exists {
return nil, errors.Errorf("no MSP found for MSP with ID of %s", org.MSPID())
}View on GitHub (pinned to 2736b63f8f)
Solutions
- Verify the block is actually a config block (its data contains a ConfigEnvelope) — e.g., check protoutil.IsConfigBlock(block) before the call.
- Read the wrapped inner error; if it is a proto unmarshal failure the block bytes are corrupt — re-pull the config block from a healthy orderer.
- Ensure the block belongs to the intended channel; pull the latest config block via BlockPuller targeting the correct channel.
- Check the BCCSP configuration (keystore, softvsHSM) of the node invoking the extraction.
- Confirm the Fabric binary version is consistent across the network to avoid config-format incompatibilities.
Example fix
// before
block := ledger.GetBlockByNumber(txBlockSeq) // regular tx block, not a config block
criteria, err := cluster.EndpointconfigFromConfigBlock(block, bccsp) // failed extracting bundle from envelope
// after
block := ledger.GetBlockByNumber(latestSeq)
if !protoutil.IsConfigBlock(block) {
block, err = puller.PullBlock(configSeq) // fetch an actual config block
}
criteria, err := cluster.EndpointconfigFromConfigBlock(block, bccsp) Defensive patterns
Strategy: validation
Validate before calling
if !protoutil.IsConfigBlock(block) {
return nil, errors.New("block is not a config block; cannot extract endpoint config")
}
criteria, err := cluster.EndpointconfigFromConfigBlock(block, bccsp) Type guard
func isValidConfigBlock(b *common.Block) bool {
if b == nil || b.Data == nil { return false }
env, err := protoutil.ExtractEnvelope(b, 0)
return err == nil && env != nil && protoutil.IsConfigBlock(b)
} Try / catch
criteria, err := cluster.EndpointconfigFromConfigBlock(block, bccsp)
if err != nil {
if strings.Contains(err.Error(), "failed extracting bundle from envelope") {
// inner err explains why; re-pull a fresh config block from a healthy orderer and retry
return errors.Wrap(err, "config block unreadable; re-pull required")
}
return err
} Prevention
- Confirm the block is a config block (protoutil.IsConfigBlock) before extraction
- Pull the latest config block from a healthy orderer rather than trusting local copies
- Keep BCCSP crypto configuration valid and Fabric versions consistent across the network
- Log the wrapped inner error to distinguish corruption from wrong-channel/wrong-block mistakes
When it happens
Trigger: Calling cluster.EndpointconfigFromConfigBlock(block, bccsp) with a block whose first envelope (protoutil.ExtractEnvelope(block, 0)) is not a valid, well-formed ConfigEnvelope — the block is not actually a config block, or its envelope payload is corrupted/truncated.
Common situations: Passing a regular (non-config) transaction block instead of a config block; pulling a block from the wrong channel so the payload does not match expectations; a corrupted or truncated block on disk; BCCSP crypto provider misconfiguration so signatures/payloads cannot be processed; Fabric version mismatch producing an unrecognized config structure.
Related errors
- no orderer section in config block
- badly formatted message, cannot extract channel
- nil block
- missing channel header
- failed getting a new bundle from envelope of config block
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/1911f3548be8e937.
Report an issue: GitHub.