{"record":{"id":"d73ae5ba194c8cf9","repo":"hyperledger/fabric","slug":"failed-to-create-orderer-org","errorCode":null,"errorMessage":"failed to create orderer org","messagePattern":"failed to create orderer org","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/configtxgen/encoder/encoder.go","lineNumber":241,"sourceCode":"\t\taddValue(ordererGroup, channelconfig.OrderersValue(consenterProtos), channelconfig.AdminsPolicyKey)\n\t\tif consensusMetadata, err = channelconfig.MarshalBFTOptions(conf.SmartBFT); err != nil {\n\t\t\treturn nil, errors.Errorf(\"consenter options read failed with error %s for orderer type %s\", err, ConsensusTypeBFT)\n\t\t}\n\t\t// Force leader rotation to be turned off\n\t\tconf.SmartBFT.LeaderRotation = smartbft.Options_ROTATION_OFF\n\t\t// Overwrite policy manually by computing it from the consenters\n\t\tpolicies.EncodeBFTBlockVerificationPolicy(consenterProtos, ordererGroup)\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unknown orderer type: %s\", conf.OrdererType)\n\t}\n\n\taddValue(ordererGroup, channelconfig.ConsensusTypeValue(conf.OrdererType, consensusMetadata), channelconfig.AdminsPolicyKey)\n\n\tfor _, org := range conf.Organizations {\n\t\tvar err error\n\t\tordererGroup.Groups[org.Name], err = NewOrdererOrgGroup(org, channelCapabilities)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to create orderer org\")\n\t\t}\n\t}\n\n\tordererGroup.ModPolicy = channelconfig.AdminsPolicyKey\n\treturn ordererGroup, nil\n}\n\nfunc consenterProtosFromConfig(consenterMapping []*genesisconfig.Consenter) ([]*cb.Consenter, error) {\n\tvar consenterProtos []*cb.Consenter\n\tfor _, consenter := range consenterMapping {\n\t\tc := &cb.Consenter{\n\t\t\tId:    consenter.ID,\n\t\t\tHost:  consenter.Host,\n\t\t\tPort:  consenter.Port,\n\t\t\tMspId: consenter.MSPID,\n\t\t}\n\t\t// Expect the user to set the config value for client/server certs or identity to the\n\t\t// path where they are persisted locally, then load these files to memory.","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/configtxgen/encoder/encoder.go#L223-L259","documentation":"After building the orderer group itself, NewOrdererGroup creates each orderer organization's config group via NewOrdererOrgGroup. If any organization fails (typically missing/invalid MSP definition or policy problems), the failure is wrapped with 'failed to create orderer org'. The wrapped error names the specific org problem.","triggerScenarios":"NewOrdererGroup iterating conf.Organizations where NewOrdererOrgGroup(org, channelCapabilities) errors for some org — e.g. org with no MSPDir, unreadable MSP directory, or invalid org policies.","commonSituations":"configtx.yaml Orderer.Organizations entries whose MSPDir points to a nonexistent crypto-config path, running configtxgen before generating crypto material with cryptogen/cryptotool, or referencing an org not defined in the Organizations section.","solutions":["Read the wrapped cause — it tells which org and which field (often MSPDir) failed","Generate the crypto material first (cryptogen generate or your CA tooling) and confirm MSPDir exists","Verify each org in Orderer.Organizations is declared under Organizations with ID and MSPDir set","Use absolute or correctly relative MSPDir paths from where configtxgen runs"],"exampleFix":"# before\n- &OrdererOrg\n    Name: OrdererOrg\n    ID: OrdererMSP\n    MSPDir: crypto-config/missing/ordererOrganizations\n# after\n- &OrdererOrg\n    Name: OrdererOrg\n    ID: OrdererMSP\n    MSPDir: crypto-config/ordererOrganizations/example.com/msp","handlingStrategy":"validation","validationCode":"func validateOrdererOrgs(orgs []*genesisconfig.Organization) error {\n    for _, org := range orgs {\n        if org.MSPDir == \"\" { return fmt.Errorf(\"org %q missing MSPDir\", org.Name) }\n        if fi, err := os.Stat(org.MSPDir); err != nil || !fi.IsDir() {\n            return fmt.Errorf(\"org %q MSPDir %q not found\", org.Name, org.MSPDir)\n        }\n    }\n    return nil\n}","typeGuard":"func hasValidMSPDir(org *genesisconfig.Organization) bool {\n    fi, err := os.Stat(org.MSPDir); return err == nil && fi.IsDir()\n}","tryCatchPattern":"group, err := encoder.NewOrdererGroup(conf, caps)\nif err != nil && strings.Contains(err.Error(), \"failed to create orderer org\") {\n    return fmt.Errorf(\"check org MSPDir/policies: %w\", err)\n}","preventionTips":["Run cryptogen (or your CA) before configtxgen so MSP directories exist","Ensure every org referenced under Orderer.Organizations is defined in the Organizations section","Use paths relative to where configtxgen actually executes, or absolute paths"],"tags":["config","hyperledger-fabric","msp","organizations"],"backgroundTag":"msp-directory-not-found","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}