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

  1. Generate the channel config with configtxgen so ChannelGroup.Values contains the standard channel values
  2. When building Config manually, populate ChannelGroup.Values (at minimum HashingAlgorithm, BlockDataHashingStructure, ChannelRestrictions, OrdererAddresses)
  3. 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

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


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