hyperledger/fabric · error

no config found in envelope

Error message

no config found in envelope

What it means

extractChannelConfig takes the config envelope embedded in a block and unmarshals it as a ConfigEnvelope of HeaderType_CONFIG. If the resulting envelope has a nil Config field, there is no usable config payload inside, so this error is returned. It guards downstream code that assumes configEnv.Config (and its ChannelGroup) exist.

Source

Thrown at common/channelconfig/util.go:288

		mspids = append(mspids, org.MSPID())
	}
	return mspids, nil
}

func extractChannelConfig(block *cb.Block, bccsp bccsp.BCCSP) (*ChannelConfig, error) {
	envelopeConfig, err := protoutil.ExtractEnvelope(block, 0)
	if err != nil {
		return nil, errors.WithMessage(err, "malformed configuration block")
	}

	configEnv := &cb.ConfigEnvelope{}
	_, err = protoutil.UnmarshalEnvelopeOfType(envelopeConfig, cb.HeaderType_CONFIG, configEnv)
	if err != nil {
		return nil, errors.WithMessage(err, "malformed configuration envelope")
	}

	if configEnv.Config == nil {
		return nil, errors.New("no config found in envelope")
	}

	if configEnv.Config.ChannelGroup == nil {
		return nil, errors.New("no channel configuration found in the config block")
	}

	if configEnv.Config.ChannelGroup.Groups == nil {
		return nil, errors.New("no channel configuration groups are available")
	}

	_, exists := configEnv.Config.ChannelGroup.Groups[ApplicationGroupKey]
	if !exists {
		return nil, errors.Errorf("invalid configuration block, missing %s configuration group", ApplicationGroupKey)
	}

	cc, err := NewChannelConfig(configEnv.Config.ChannelGroup, bccsp)
	if err != nil {
		return nil, errors.WithMessage(err, "no valid channel configuration found")

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Pass the latest valid config block (e.g. fetched via the config block getter or delivered block with IsConfig()==true)
  2. Verify the envelope contains HeaderType_CONFIG with a populated Config field
  3. Re-fetch or repair the block source if the block itself is corrupted

Example fix

// before
block, _ := ledgerReader.Next() // arbitrary block
cc, err := extractChannelConfig(block, bccsp)
// after
block := configBlock // ensure IsConfig() / retrieved as latest config block
cc, err := extractChannelConfig(block, bccsp)
Defensive patterns

Strategy: type-guard

Validate before calling

func hasConfig(env *cb.Envelope) bool {
	payload, err := protoutil.UnmarshalPayload(env.Payload)
	if err != nil || payload.Header == nil {
		return false
	}
	ch, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)
	return err == nil && ch.Type == int32(cb.HeaderType_CONFIG)
}

Try / catch

cc, err := extractChannelConfig(block, bccsp)
if err != nil {
	if strings.Contains(err.Error(), "no config found in envelope") {
		return fmt.Errorf("block does not contain a config envelope; fetch the latest config block: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: Calling ValidateCapabilities or ExtractMSPIDsForApplicationOrgs with a block/envelope whose payload is not a real CONFIG transaction — e.g. an empty payload, a config-update envelope without embedded config, or a corrupted/malformed block.

Common situations: Fetching the wrong index from a peer/orderer (an empty or non-config block instead of the latest config block); tooling constructing envelopes manually and leaving Config unset; truncated or corrupted ledger files.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/e3a9787213150aa6. Report an issue: GitHub.