hyperledger/fabric · error
Nil config envelope Config
Error message
Nil config envelope Config
What it means
validateConfigBlock successfully unmarshaled the envelope into a common.ConfigEnvelope, but the inner Config field is nil. The envelope was the right type, yet its payload contained an empty/unpopulated ConfigEnvelope (no channel configuration at all). cscc refuses to proceed because there is no configuration to apply to the channel.
Source
Thrown at core/scc/cscc/configure.go:229
}
return shim.Error(fmt.Sprintf("Requested function %s not found.", fname))
}
// validateConfigBlock validate configuration block to see whenever it's contains valid config transaction
func validateConfigBlock(block *common.Block, bccsp bccsp.BCCSP) error {
envelopeConfig, err := protoutil.ExtractEnvelope(block, 0)
if err != nil {
return errors.Errorf("Failed to %s", err)
}
configEnv := &common.ConfigEnvelope{}
_, err = protoutil.UnmarshalEnvelopeOfType(envelopeConfig, common.HeaderType_CONFIG, configEnv)
if err != nil {
return errors.Errorf("Bad configuration envelope: %s", err)
}
if configEnv.Config == nil {
return errors.New("Nil config envelope Config")
}
if configEnv.Config.ChannelGroup == nil {
return errors.New("Nil channel group")
}
if configEnv.Config.ChannelGroup.Groups == nil {
return errors.New("No channel configuration groups are available")
}
_, exists := configEnv.Config.ChannelGroup.Groups[channelconfig.ApplicationGroupKey]
if !exists {
return errors.Errorf("Invalid configuration block, missing %s "+
"configuration group", channelconfig.ApplicationGroupKey)
}
// Check the capabilities requirement
if err = channelconfig.ValidateCapabilities(block, bccsp); err != nil {View on GitHub (pinned to 2736b63f8f)
Solutions
- Populate ConfigEnvelope.Config with the *common.Config produced by configtxgen/configtxlator (or from an Update message applied to the previous config)
- If starting a new channel, generate a proper genesis block via `configtxgen -profile <profile> -channelID <id> -outputBlock genesis.block` and extract its config envelope
- Validate the decoded envelope client-side before submission: `if env.Config == nil { fail }`
- Re-encode with `configtxlator proto_encode --type common.ConfigEnvelope` to ensure the Config field is serialized
Example fix
// before
configEnv := &common.ConfigEnvelope{ChannelId: chID}
// after
cfg := readConfigFromConfigtxlatorOrGenesisBlock()
configEnv := &common.ConfigEnvelope{ChannelId: chID, Config: cfg} Defensive patterns
Strategy: validation
Validate before calling
if configEnv.Config == nil {
return errors.New("refusing to submit: ConfigEnvelope.Config is nil; regenerate with configtxgen")
} Type guard
func hasConfig(env *common.ConfigEnvelope) bool { return env != nil && env.Config != nil } Try / catch
if configEnv.Config == nil {
return fmt.Errorf("nil Config in ConfigEnvelope: regenerate genesis/config tx with configtxgen")
} Prevention
- Populate both ChannelId and Config fields when constructing a ConfigEnvelope
- Round-trip check: proto_decode the encoded envelope and assert Config != nil
- Prefer configtxgen/configtxlator output over hand-built structs
- Unit-test the envelope construction before invoking cscc
When it happens
Trigger: Submitting a ConfigEnvelope created with only ChannelId/Sequence set but Config left nil; constructing the envelope manually and forgetting to assign the *common.Config obtained from configtxlator/proto_decode; an unmarshaled default ConfigEnvelope{} passed to JoinChain.
Common situations: Hand-rolled channel creation scripts that allocate the envelope struct without populating it; configtxlator round-trips where only the wrapper was re-encoded; partially written tools that extract the envelope but drop the payload.
Related errors
- Bad configuration envelope: %s
- Nil channel group
- chaincode name '%s' is reserved for system chaincodes
- No channel configuration groups are available
- Invalid configuration block, missing %s configuration group
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/afc09e73ed439319.
Report an issue: GitHub.