{"record":{"id":"f1d166622eb135e4","repo":"hyperledger/fabric","slug":"could-not-get-application-config-for-the-channel","errorCode":null,"errorMessage":"could not get application config for the channel","messagePattern":"could not get application config for the channel","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/channelconfig/util.go","lineNumber":265,"sourceCode":"\t}\n\t// Check the channel top-level capabilities\n\tif err := cc.Capabilities().Supported(); err != nil {\n\t\treturn err\n\t}\n\n\t// Check the application capabilities\n\treturn cc.ApplicationConfig().Capabilities().Supported()\n}\n\n// ExtractMSPIDsForApplicationOrgs extracts MSPIDs for application organizations\nfunc ExtractMSPIDsForApplicationOrgs(block *cb.Block, bccsp bccsp.BCCSP) ([]string, error) {\n\tcc, err := extractChannelConfig(block, bccsp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif cc.ApplicationConfig() == nil {\n\t\treturn nil, errors.Errorf(\"could not get application config for the channel\")\n\t}\n\torgs := cc.ApplicationConfig().Organizations()\n\tmspids := make([]string, 0, len(orgs))\n\tfor _, org := range orgs {\n\t\tmspids = append(mspids, org.MSPID())\n\t}\n\treturn mspids, nil\n}\n\nfunc extractChannelConfig(block *cb.Block, bccsp bccsp.BCCSP) (*ChannelConfig, error) {\n\tenvelopeConfig, err := protoutil.ExtractEnvelope(block, 0)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"malformed configuration block\")\n\t}\n\n\tconfigEnv := &cb.ConfigEnvelope{}\n\t_, err = protoutil.UnmarshalEnvelopeOfType(envelopeConfig, cb.HeaderType_CONFIG, configEnv)\n\tif err != nil {","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/channelconfig/util.go#L247-L283","documentation":"ExtractMSPIDsForApplicationOrgs extracts the MSP IDs of all application orgs from a config block. After decoding the block, it requires the channel to actually have an Application config; if ApplicationConfig() returns nil (application-only config absent), this error is returned. Channels without an Application section (e.g. pure ordering/system-style configs) cannot provide application org MSP IDs.","triggerScenarios":"Calling ExtractMSPIDsForApplicationOrgs (or getAllMSPIDs) with a config block from a channel that has no Application group — e.g. an orderer-only channel or the system channel's genesis block.","commonSituations":"Pointing tooling/SDK code at the wrong block (system or orderer channel instead of an application channel); channels created before the Application section existed or stripped of it; peer/orderer tooling invoked on genesis blocks lacking application config.","solutions":["Pass the config block of an application channel (one containing an Application group with orgs)","Verify you didn't fetch the system/orderer-only channel's block by mistake","If the channel legitimately lacks application config, don't use this helper; read MSP IDs from the Orderer/Consortium config instead"],"exampleFix":"// before\nmspIDs, err := ExtractMSPIDsForApplicationOrgs(systemChannelBlock, bccsp)\n// after\nmspIDs, err := ExtractMSPIDsForApplicationOrgs(appChannelBlock, bccsp)","handlingStrategy":"validation","validationCode":"cc, err := channelconfig.NewChannelConfig(channelGroup, bccsp)\nif err != nil {\n\treturn err\n}\nif cc.ApplicationConfig() == nil {\n\treturn fmt.Errorf(\"block's channel has no Application config; use an application channel block\")\n}","typeGuard":null,"tryCatchPattern":"mspIDs, err := channelconfig.ExtractMSPIDsForApplicationOrgs(block, bccsp)\nif err != nil && strings.Contains(err.Error(), \"could not get application config\") {\n\treturn fmt.Errorf(\"supplied block is from a channel without Application config: %w\", err)\n}","preventionTips":["Verify the block is from an application channel before extracting application MSP IDs","Don't pass system/orderer-only channel blocks to this helper","Check cc.ApplicationConfig() != nil before dereferencing Organizations()"],"tags":["hyperledger-fabric","channelconfig","application","blocks"],"backgroundTag":"missing-application-config","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"}