{"record":{"id":"a4fc37c9fb04a440","repo":"hyperledger/fabric","slug":"error-adding-policies-to-channel-group","errorCode":null,"errorMessage":"error adding policies to channel group","messagePattern":"error adding policies to channel group","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/configtxgen/encoder/encoder.go","lineNumber":139,"sourceCode":"\t\t\t\t\tValue: protoutil.MarshalOrPanic(sp),\n\t\t\t\t},\n\t\t\t}\n\t\tdefault:\n\t\t\treturn errors.Errorf(\"unknown policy type: %s\", policy.Type)\n\t\t}\n\t}\n\treturn nil\n}\n\n// NewChannelGroup defines the root of the channel configuration.  It defines basic operating principles like the hashing\n// algorithm used for the blocks, as well as the location of the ordering service.  It will recursively call into the\n// NewOrdererGroup, NewConsortiumsGroup, and NewApplicationGroup depending on whether these sub-elements are set in the\n// configuration.  All mod_policy values are set to \"Admins\" for this group, with the exception of the OrdererAddresses\n// value which is set to \"/Channel/Orderer/Admins\".\nfunc NewChannelGroup(conf *genesisconfig.Profile) (*cb.ConfigGroup, error) {\n\tchannelGroup := protoutil.NewConfigGroup()\n\tif err := AddPolicies(channelGroup, conf.Policies, channelconfig.AdminsPolicyKey); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error adding policies to channel group\")\n\t}\n\n\taddValue(channelGroup, channelconfig.HashingAlgorithmValue(), channelconfig.AdminsPolicyKey)\n\taddValue(channelGroup, channelconfig.BlockDataHashingStructureValue(), channelconfig.AdminsPolicyKey)\n\tif conf.Orderer != nil && len(conf.Orderer.Addresses) > 0 {\n\t\taddValue(channelGroup, channelconfig.OrdererAddressesValue(conf.Orderer.Addresses), ordererAdminsPolicyName)\n\t}\n\n\tif conf.Consortium != \"\" {\n\t\taddValue(channelGroup, channelconfig.ConsortiumValue(conf.Consortium), channelconfig.AdminsPolicyKey)\n\t}\n\n\tif len(conf.Capabilities) > 0 {\n\t\taddValue(channelGroup, channelconfig.CapabilitiesValue(conf.Capabilities), channelconfig.AdminsPolicyKey)\n\t}\n\n\tvar err error\n\tif conf.Orderer != nil {","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/configtxgen/encoder/encoder.go#L121-L157","documentation":"Wrapping error in NewChannelGroup: AddPolicies failed while installing the channel-level (Applications/Orderer root group) policies. The wrapped error (e.g. invalid policy rule or unknown policy type) is the real cause; this wrapper just contextualizes it to the channel group.","triggerScenarios":"Thrown at internal/configtxgen/encoder/encoder.go:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped cause: fix the offending policy rule or type in the profile's Policies section","Ensure required policies (Readers, Writers, Admins) are defined and use valid ImplicitMeta or Signature syntax","Regenerate with configtxgen once the Policies block in configtx.yaml is corrected"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}