hyperledger/fabric · error

failed to create consortium org

Error message

failed to create consortium org

What it means

NewConsortiumGroup wraps errors from NewConsortiumOrgGroup while building the org sub-groups of a single consortium. It means one of the organizations listed in the consortium could not be converted into a config group (usually an invalid MSP/org definition). The consortium-level wrapper loses the org name; inspect the innermost error for the specific reason.

Source

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

			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")
		}
	}

	addValue(consortiumGroup, channelconfig.ChannelCreationPolicyValue(policies.ImplicitMetaAnyPolicy(channelconfig.AdminsPolicyKey).Value()), ordererAdminsPolicyName)

	consortiumGroup.ModPolicy = ordererAdminsPolicyName
	return consortiumGroup, nil
}

// NewChannelCreateConfigUpdate generates a ConfigUpdate which can be sent to the orderer to create a new channel.  Optionally, the channel group of the
// ordering system channel may be passed in, and the resulting ConfigUpdate will extract the appropriate versions from this file.
func NewChannelCreateConfigUpdate(channelID string, conf *genesisconfig.Profile, templateConfig *cb.ConfigGroup) (*cb.ConfigUpdate, error) {
	if conf.Application == nil {
		return nil, errors.New("cannot define a new channel with no Application section")
	}

	if conf.Consortium == "" {
		return nil, errors.New("cannot define a new channel with no Consortium value")

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Inspect the innermost wrapped error to find the failing org and fix its definition (MSPDir, ID, Name).
  2. Ensure every org in the consortium's Organizations list is declared and spelled correctly under the profile's Organizations section.
  3. Validate the MSP directory exists and contains valid signing/admin certs before generating genesis material.

Example fix

// before
- &Org3
  Name: Org3
  # MSPDir missing
// after
- &Org3
  Name: Org3
  ID: Org3MSP
  MSPDir: crypto-config/peerOrganizations/org3.example.com/msp
Defensive patterns

Strategy: validation

Validate before calling

for _, org := range consortium.Organizations {
    if org == nil || org.Name == "" || org.ID == "" || org.MSPDir == "" {
        return fmt.Errorf("consortium org invalid: %+v", org)
    }
    if _, err := os.Stat(org.MSPDir); err != nil {
        return fmt.Errorf("MSPDir %q missing: %w", org.MSPDir, err)
    }
}

Type guard

func isWellFormedOrg(o *genesisconfig.Organization) bool {
    return o != nil && o.Name != "" && o.ID != "" && o.MSPDir != ""
}

Try / catch

_, err := encoder.NewConsortiumGroup(consortiumConf)
if err != nil {
    if strings.Contains(err.Error(), "failed to create consortium org") {
        // iterate orgs, validate MSP definitions
    }
    return err
}

Prevention

When it happens

Trigger: Any call chain NewConsortiumsGroup -> NewConsortiumGroup -> NewConsortiumOrgGroup where an org in conf.Organizations fails encoding — e.g. NewConsortiumOrgGroup returns an error for a nil/invalid org, missing MSPDir, or invalid endpoint/anchor config.

Common situations: Typo in an org anchor in configtx.yaml, an org referenced in the consortium defined without a valid MSPDir/ID, or an org YAML section failing unmarshalling into genesisconfig.Organization.

Related errors


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