{"record":{"id":"e3c8770f774b79d2","repo":"hyperledger/fabric","slug":"could-not-get-application-config-for-channel-s-e3c877","errorCode":null,"errorMessage":"could not get application config for channel '%s'","messagePattern":"could not get application config for channel '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/lifecycle/lifecycle.go","lineNumber":288,"sourceCode":"\n\treturn true, definedChaincode, nil\n}\n\nfunc (r *Resources) LifecycleEndorsementPolicyAsBytes(channelID string) ([]byte, error) {\n\tchannelConfig := r.ChannelConfigSource.GetStableChannelConfig(channelID)\n\tif channelConfig == nil {\n\t\treturn nil, errors.Errorf(\"could not get channel config for channel '%s'\", channelID)\n\t}\n\n\tif _, ok := channelConfig.PolicyManager().GetPolicy(LifecycleEndorsementPolicyRef); ok {\n\t\treturn LifecycleDefaultEndorsementPolicyBytes, nil\n\t}\n\n\t// This was a channel which was upgraded or did not define a lifecycle endorsement policy, use a default\n\t// of \"a majority of orgs must have a member sign\".\n\tac, ok := channelConfig.ApplicationConfig()\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"could not get application config for channel '%s'\", channelID)\n\t}\n\torgs := ac.Organizations()\n\tmspids := make([]string, 0, len(orgs))\n\tfor _, org := range orgs {\n\t\tmspids = append(mspids, org.MSPID())\n\t}\n\n\treturn protoutil.MarshalOrPanic(&cb.ApplicationPolicy{\n\t\tType: &cb.ApplicationPolicy_SignaturePolicy{\n\t\t\tSignaturePolicy: policydsl.SignedByNOutOfGivenRole(int32(len(mspids)/2+1), msp.MSPRole_MEMBER, mspids),\n\t\t},\n\t}), nil\n}\n\n// ExternalFunctions is intended primarily to support the SCC functions.\n// In general, its methods signatures produce writes (which must be committed\n// as part of an endorsement flow), or return human readable errors (for\n// instance indicating a chaincode is not found) rather than sentinels.","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/lifecycle.go#L270-L306","documentation":"Thrown by Resources.LifecycleEndorsementPolicyAsBytes when the channel config exists but does not implement ApplicationConfig (ok == false). This happens for channels without an application group, so the default majority-of-orgs lifecycle endorsement policy cannot be computed.","triggerScenarios":"Reading the lifecycle endorsement policy for a channel whose stable config has no Application config — typically orderer-only channels or channels created without an application section.","commonSituations":"System channel or non-application channels on a peer; malformed channel creation where the Application group was omitted; testing against a channel template lacking application orgs.","solutions":["Recreate/reconfigure the channel so it includes an Application group with member organizations","Use a proper application channel for chaincode operations instead of an orderer-only channel","Check the channel's config block (configtxlator) to confirm the Application section and organizations exist"],"exampleFix":"// before\nChannel profile without Application section in configtx.yaml\n// after\nProfile:\n  Application:\n    Organizations:\n      - *Org1\n      - *Org2","handlingStrategy":"try-catch","validationCode":"cfg := channelConfigSource.GetStableChannelConfig(channelID)\nif cfg != nil {\n    if _, ok := cfg.ApplicationConfig(); !ok {\n        return fmt.Errorf(\"channel %s has no application config; cannot compute lifecycle policy\", channelID)\n    }\n}","typeGuard":"func hasApplicationConfig(cfg ChannelConfig) bool {\n    _, ok := cfg.ApplicationConfig()\n    return ok\n}","tryCatchPattern":"policyBytes, err := resources.LifecycleEndorsementPolicyAsBytes(chid)\nif err != nil {\n    if strings.Contains(err.Error(), \"could not get application config\") {\n        // recreate channel with an Application group in configtx\n    }\n    return err\n}","preventionTips":["Ensure channel creation profiles include an Application section with member orgs","Use configtxlator to inspect the channel config before deploying chaincode","Do not attempt chaincode lifecycle operations on orderer-only channels"],"tags":["hyperledger-fabric","application-config","channel-config","configtx"],"backgroundTag":"channel-config-not-found","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"}