{"record":{"id":"384db78f007b4119","repo":"hyperledger/fabric","slug":"could-not-get-channelconfig-for-channel-s","errorCode":null,"errorMessage":"could not get channelconfig for channel %s","messagePattern":"could not get channelconfig for channel (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/lifecycle/deployedcc_infoprovider.go","lineNumber":227,"sourceCode":"\t\tSimpleQueryExecutor: qe,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not get info about chaincode\")\n\t}\n\n\tif !exists {\n\t\t// Implicit collections are a v2.0 lifecycle concept, if the chaincode is not in the new lifecycle, return nothing\n\t\treturn nil, nil\n\t}\n\n\treturn vc.ChaincodeImplicitCollections(channelName)\n}\n\n// ChaincodeImplicitCollections assumes the chaincode exists in the new lifecycle and returns the implicit collections\nfunc (vc *ValidatorCommitter) ChaincodeImplicitCollections(channelName string) ([]*pb.StaticCollectionConfig, error) {\n\tchannelConfig := vc.Resources.ChannelConfigSource.GetStableChannelConfig(channelName)\n\tif channelConfig == nil {\n\t\treturn nil, errors.Errorf(\"could not get channelconfig for channel %s\", channelName)\n\t}\n\tac, ok := channelConfig.ApplicationConfig()\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"could not get application config for channel %s\", channelName)\n\t}\n\n\torgs := ac.Organizations()\n\timplicitCollections := make([]*pb.StaticCollectionConfig, 0, len(orgs))\n\tfor _, org := range orgs {\n\t\timplicitCollections = append(implicitCollections, vc.GenerateImplicitCollectionForOrg(org.MSPID()))\n\t}\n\n\treturn implicitCollections, nil\n}\n\n// GenerateImplicitCollectionForOrg generates implicit collection for the org\nfunc (vc *ValidatorCommitter) GenerateImplicitCollectionForOrg(mspid string) *pb.StaticCollectionConfig {\n\t// set Required/MaxPeerCount to 0 if it is other org's implicit collection (mspid does not match peer's local mspid)","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/deployedcc_infoprovider.go#L209-L245","documentation":"ValidatorCommitter.ChaincodeImplicitCollections fetches the stable channel config for channelName and throws this when GetStableChannelConfig returns nil, i.e. no channelconfig is available for that channel in the resources. Implicit (per-org) collections require resolvable channel config.","triggerScenarios":"Calling ChaincodeImplicitCollections(channelName) (via ImplicitCollections) when the channel config is not in the ChannelConfigSource — unknown channel, config bundle not yet loaded, or channel removed.","commonSituations":"Querying implicit collections on a channel the peer has not joined or whose config bundle was not loaded at startup; channel name mismatch between ledger and config source; config source not wired correctly in tests.","solutions":["Verify the channel exists and the peer joined it, so the config bundle is loaded.","Ensure ChannelConfigSource is properly initialized before lifecycle validator/committer calls.","Use the exact channel name as recorded in the ledger/configtx.","In tests, register a mock channel config for the channel under test."],"exampleFix":"// before\nccs, err := vc.ChaincodeImplicitCollections(channelName)\n// after\nif vc.Resources.ChannelConfigSource.GetStableChannelConfig(channelName) == nil {\n    return nil, fmt.Errorf(\"channel %s config not loaded; join channel or fix config source\", channelName)\n}\nccs, err := vc.ChaincodeImplicitCollections(channelName)","handlingStrategy":"validation","validationCode":"if vc.Resources.ChannelConfigSource.GetStableChannelConfig(channelName) == nil {\n    return fmt.Errorf(\"no channel config available for %s\", channelName)\n}","typeGuard":null,"tryCatchPattern":"ccs, err := vc.ChaincodeImplicitCollections(channelName)\nif err != nil && strings.Contains(err.Error(), \"could not get channelconfig\") {\n    return nil, fmt.Errorf(\"channel %s config not loaded: %w\", channelName, err)\n}","preventionTips":["Join the channel and let the config bundle load before implicit-collection queries.","Wire a valid ChannelConfigSource in tests and production.","Use the exact channel name from the ledger record."],"tags":["fabric","channel-config","collections"],"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-08T10:18:20.063Z"}