hyperledger/fabric · error
field Config.ChannelGroup.Values is nil
Error message
field Config.ChannelGroup.Values is nil
What it means
Also from discovery service ValidateConfig: after checking the Orderer/Application groups, it requires Config.ChannelGroup.Values to be non-nil. The root channel group must carry values (e.g. HashingAlgorithm, BlockDataHashingStructure, OrdererAddresses); a nil Values map means the config lacks the mandatory channel-level parameters discovery needs.
Source
Thrown at discovery/support/config/support.go:246
func ValidateConfig(c *common.Config) error {
if c.ChannelGroup == nil {
return errors.New("field Config.ChannelGroup is nil")
}
grps := c.ChannelGroup.Groups
if grps == nil {
return errors.New("field Config.ChannelGroup.Groups is nil")
}
for _, field := range []string{channelconfig.OrdererGroupKey, channelconfig.ApplicationGroupKey} {
grp, exists := grps[field]
if !exists {
return fmt.Errorf("key Config.ChannelGroup.Groups[%s] is missing", field)
}
if grp.Groups == nil {
return fmt.Errorf("key Config.ChannelGroup.Groups[%s].Groups is nil", field)
}
}
if c.ChannelGroup.Values == nil {
return errors.New("field Config.ChannelGroup.Values is nil")
}
return nil
}
View on GitHub (pinned to 2736b63f8f)
Solutions
- Generate the channel config with configtxgen so ChannelGroup.Values contains the standard channel values
- When building Config manually, populate ChannelGroup.Values (at minimum HashingAlgorithm, BlockDataHashingStructure, ChannelRestrictions, OrdererAddresses)
- Inspect the config with configtxlator decode to confirm ChannelGroup.Values is present before passing it to discovery
Example fix
// before
cfg.ChannelGroup = &common.ConfigGroup{Groups: map[string]*common.ConfigGroup{...}}
// after
cfg.ChannelGroup = &common.ConfigGroup{
Groups: map[string]*common.ConfigGroup{...},
Values: map[string]*common.ConfigValue{
"HashingAlgorithm": {...},
"BlockDataHashingStructure": {...},
},
} Defensive patterns
Strategy: validation
Validate before calling
func hasChannelValues(cfg *common.Config) bool {
return cfg != nil && cfg.ChannelGroup != nil && cfg.ChannelGroup.Values != nil
}
// if !hasChannelValues(cfg) { repopulate values before ValidateConfig } Type guard
if cfg != nil && cfg.ChannelGroup != nil && cfg.ChannelGroup.Values != nil { /* safe */ } Prevention
- Never strip ChannelGroup.Values when patching configs programmatically
- Keep channel-level values (HashingAlgorithm etc.) in every generated config
- Validate configs with configtxlator before handing them to discovery
When it happens
Trigger: ValidateConfig receives a Config whose ChannelGroup exists and has Groups but with Values == nil — typically a hand-assembled Config, a config built before channel values were attached, or deserialization of an incomplete config.
Common situations: Writing custom tools that patch channel configs; tests that stub common.Config with only Groups populated; feeding an empty or partial config block into discovery support initialization.
Related errors
- key Config.ChannelGroup.Groups[%s].Groups is nil
- failed parsing MSPConfig
- invalid consensus type property in config: %v
- malformed org definition for org: %s
- error encode input
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/794078742b2a751d.
Report an issue: GitHub.