hyperledger/fabric · error

channel template configs must contain an application section

Error message

channel template configs must contain an application section

What it means

DefaultConfigTemplate builds a channel-creation template by stripping values/policies from the Application group of a full channel group. It requires the generated channel group to contain an Application sub-group; if absent the profile cannot serve as a channel-creation template and this error is thrown.

Source

Thrown at internal/configtxgen/encoder/encoder.go:494

		Value: protoutil.MarshalOrPanic(&cb.Consortium{
			Name: conf.Consortium,
		}),
	}

	return updt, nil
}

// DefaultConfigTemplate generates a config template based on the assumption that
// the input profile is a channel creation template and no system channel context
// is available.
func DefaultConfigTemplate(conf *genesisconfig.Profile) (*cb.ConfigGroup, error) {
	channelGroup, err := NewChannelGroup(conf)
	if err != nil {
		return nil, errors.WithMessage(err, "error parsing configuration")
	}

	if _, ok := channelGroup.Groups[channelconfig.ApplicationGroupKey]; !ok {
		return nil, errors.New("channel template configs must contain an application section")
	}

	channelGroup.Groups[channelconfig.ApplicationGroupKey].Values = nil
	channelGroup.Groups[channelconfig.ApplicationGroupKey].Policies = nil

	return channelGroup, nil
}

func ConfigTemplateFromGroup(conf *genesisconfig.Profile, cg *cb.ConfigGroup) (*cb.ConfigGroup, error) {
	template := proto.Clone(cg).(*cb.ConfigGroup)
	if template.Groups == nil {
		return nil, errors.Errorf("supplied system channel group has no sub-groups")
	}

	template.Groups[channelconfig.ApplicationGroupKey] = &cb.ConfigGroup{
		Groups: map[string]*cb.ConfigGroup{},
		Policies: map[string]*cb.ConfigPolicy{
			channelconfig.AdminsPolicyKey: {},

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Use a profile that defines an Application section with at least one organization.
  2. Point --profile at the intended application-channel profile in configtx.yaml.
  3. Verify the Application group survives encoding (no errors silently skipping it).

Example fix

# before
Profile:
  OrdererGenesis:   # system channel profile mistakenly reused
    ...
# after
Profile:
  MyChannel:
    Consortium: SampleConsortium
    Application:
      Organizations:
        - *Org1
Defensive patterns

Strategy: validation

Validate before calling

if profile.Application == nil {
    return errors.New("DefaultConfigTemplate requires a profile with an Application section")
}

Type guard

func isAppChannelProfile(p *genesisconfig.Profile) bool {
    return p != nil && p.Application != nil
}

Try / catch

tmpl, err := encoder.DefaultConfigTemplate(profile)
if err != nil && strings.Contains(err.Error(), "must contain an application section") {
    return errors.New("switch to an application-channel profile")
}

Prevention

When it happens

Trigger: Calling DefaultConfigTemplate with a profile whose NewChannelGroup output lacks the Application group — i.e. a profile with no valid Application section (orderer-only or consortium-style profile).

Common situations: Using the system channel profile or an orderer-only profile where an application-channel profile is expected for MakeChannelCreationTransaction / outputCreateChannelTx.

Related errors


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