hyperledger/fabric · error

key Config.ChannelGroup.Groups[%s] is missing

Error message

key Config.ChannelGroup.Groups[%s] is missing

What it means

ValidateConfig checks that both required sub-groups exist under Config.ChannelGroup.Groups: channelconfig.OrdererGroupKey ("Orderer") and channelconfig.ApplicationGroupKey ("Application"). If either key is absent, the channel config is structurally invalid for discovery and this formatted error names the missing key; Config wraps it with 'config is invalid' and fails the discovery request.

Source

Thrown at discovery/support/config/support.go:239

			output[fabricConfig.Name] = fabricConfig
		}
	}

	return nil
}

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. Recreate the channel config from a configtx.yaml profile that defines both Orderer and Application organizations so both groups are present.
  2. If the Application group was intentionally omitted (e.g. orderer-only channel), the discovery service cannot serve org/MSP data for it; use a standard application channel instead.
  3. Check configtxlator output of the latest config block to confirm which group is missing, then perform a config update adding the missing group.
  4. Extend fixtures/mocks in tests to include both grps[channelconfig.OrdererGroupKey] and grps[channelconfig.ApplicationGroupKey] with non-nil Groups maps.

Example fix

// before: only Orderer group
Groups: map[string]*common.ConfigGroup{
  channelconfig.OrdererGroupKey: ordererGroup,
}

// after: both required groups
Groups: map[string]*common.ConfigGroup{
  channelconfig.OrdererGroupKey:     ordererGroup,
  channelconfig.ApplicationGroupKey: applicationGroup,
}
Defensive patterns

Strategy: validation

Validate before calling

if err := config.ValidateConfig(cfg); err != nil {
	return err
}
// Optional stricter pre-check naming each required group:
for _, key := range []string{channelconfig.OrdererGroupKey, channelconfig.ApplicationGroupKey} {
	grp, ok := cfg.ChannelGroup.Groups[key]
	if !ok {
		return fmt.Errorf("channel config lacks %s group", key)
	}
	if grp.Groups == nil {
		return fmt.Errorf("%s group has nil Groups map", key)
	}
}

Type guard

func hasRequiredGroups(c *common.Config) bool {
	if c == nil || c.ChannelGroup == nil || c.ChannelGroup.Groups == nil {
		return false
	}
	_, o := c.ChannelGroup.Groups[channelconfig.OrdererGroupKey]
	_, a := c.ChannelGroup.Groups[channelconfig.ApplicationGroupKey]
	return o && a
}

Try / catch

res, err := support.Config(channel)
if err != nil {
	if strings.Contains(err.Error(), "is missing") && strings.Contains(err.Error(), "Groups[") {
		return nil, fmt.Errorf("channel %s is missing a required Orderer/Application group: %w", channel, err)
	}
	return nil, err
}

Prevention

When it happens

Trigger: A channel config whose Groups map exists but lacks "Orderer" or "Application": (1) application-only or test configs that omit the Orderer group; (2) system-channel or non-standard configs missing the Application group; (3) configs built by tooling that only added one of the two groups; (4) mutated config maps that deleted a group during an update.

Common situations: Configuring discovery against a channel created without an Application section; test fixtures with only an Orderer group; automated config-edit scripts removing a group; fabric versions/networks where the channel was created from a minimal profile.

Related errors


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