hyperledger/fabric · error

failed to create consortium %s

Error message

failed to create consortium %s

What it means

This error is wrapped by NewConsortiumsGroup when building the Consortiums group of a channel config: it calls NewConsortiumGroup for each consortium in the profile and one of them failed. The underlying cause (e.g. a bad org definition) is wrapped with the consortium's name so the failing consortium can be identified. It indicates a malformed Consortiums section in the configtx profile.

Source

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

		addValue(applicationOrgGroup, channelconfig.AnchorPeersValue(anchorProtos), channelconfig.AdminsPolicyKey)
	}

	return applicationOrgGroup, nil
}

// NewConsortiumsGroup returns the consortiums component of the channel configuration.  This element is only defined for the ordering system channel.
// It sets the mod_policy for all elements to "/Channel/Orderer/Admins".
func NewConsortiumsGroup(conf map[string]*genesisconfig.Consortium) (*cb.ConfigGroup, error) {
	consortiumsGroup := protoutil.NewConfigGroup()
	// This policy is not referenced anywhere, it is only used as part of the implicit meta policy rule at the channel level, so this setting
	// effectively degrades control of the ordering system channel to the ordering admins
	addPolicy(consortiumsGroup, policies.SignaturePolicy(channelconfig.AdminsPolicyKey, policydsl.AcceptAllPolicy), ordererAdminsPolicyName)

	for consortiumName, consortium := range conf {
		var err error
		consortiumsGroup.Groups[consortiumName], err = NewConsortiumGroup(consortium)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to create consortium %s", consortiumName)
		}
	}

	consortiumsGroup.ModPolicy = ordererAdminsPolicyName
	return consortiumsGroup, nil
}

// NewConsortiumGroup returns a consortium component of the channel configuration. Each consortium defines the organizations which may be involved in channel
// creation, as well as the channel creation policy the orderer checks at channel creation time to authorize the action. It sets the mod_policy of all
// elements to "/Channel/Orderer/Admins".
func NewConsortiumGroup(conf *genesisconfig.Consortium) (*cb.ConfigGroup, error) {
	consortiumGroup := protoutil.NewConfigGroup()

	for _, org := range conf.Organizations {
		var err error
		consortiumGroup.Groups[org.Name], err = NewConsortiumOrgGroup(org)
		if err != nil {
			return nil, errors.Wrap(err, "failed to create consortium org")

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Look at the wrapped inner error to identify which consortium org failed and fix that org's definition (MSPDir, ID, Name).
  2. Verify every org listed under Consortiums -> <name> -> Organizations exists in the profile's Organizations section and validates as an MSP.
  3. Run configtxgen with the same profile to reproduce and inspect the full wrapped error chain.

Example fix

// before (configtx.yaml)
Consortiums:
  SampleConsortium:
    Organizations:
      - *OrgMissingMSP
// after
Consortiums:
  SampleConsortium:
    Organizations:
      - *Org1   # org with valid Name, ID, and MSPDir
Defensive patterns

Strategy: validation

Validate before calling

for name, consortium := range profile.Consortiums {
    if len(consortium.Organizations) == 0 {
        return fmt.Errorf("consortium %s has no organizations", name)
    }
    for _, org := range consortium.Organizations {
        if org.MSPDir == "" || org.ID == "" {
            return fmt.Errorf("consortium %s org %s missing MSPDir/ID", name, org.Name)
        }
    }
}

Type guard

func hasValidConsortiums(p *genesisconfig.Profile) bool {
    return p != nil && len(p.Consortiums) > 0
}

Try / catch

group, err := encoder.NewChannelGroup(profile)
if err != nil {
    if strings.Contains(err.Error(), "failed to create consortium") {
        // log consortium name from wrapped message, fix org defs
    }
    return err
}

Prevention

When it happens

Trigger: Calling NewChannelGroup (directly or via MakeGenesisBlock/encoder functions) on a genesisconfig.Profile whose Consortiums map contains a consortium whose Organizations list fails NewConsortiumOrgGroup (e.g. an org with missing/invalid MSPDir or ID).

Common situations: configtx.yaml system channel profile with a Consortiums section referencing orgs whose Organization definitions are incomplete (missing MSPDir or Name/ID mismatch), typos in org names, or org entries that fail channelconfig validation.

Related errors


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