{"record":{"id":"bfbd238f10379828","repo":"hyperledger/fabric","slug":"no-collection-config-was-found-for-collection-s-f","errorCode":null,"errorMessage":"no collection config was found for collection %s for chaincode %s","messagePattern":"no collection config was found for collection (.+?) for chaincode (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/peer/deliverevents.go","lineNumber":477,"sourceCode":"type collPolicyChecker struct{}\n\n// CheckCollectionPolicy checks if the CollectionCriteria meets the policy requirement\nfunc (cs *collPolicyChecker) CheckCollectionPolicy(\n\tblockNum uint64,\n\tccName string,\n\tcollName string,\n\tcfgHistoryRetriever ledger.ConfigHistoryRetriever,\n\tdeserializer msp.IdentityDeserializer,\n\tsignedData *protoutil.SignedData,\n) (bool, error) {\n\tconfigInfo, err := cfgHistoryRetriever.MostRecentCollectionConfigBelow(blockNum, ccName)\n\tif err != nil {\n\t\treturn false, errors.WithMessagef(err, \"error getting most recent collection config below block sequence = %d for chaincode %s\", blockNum, ccName)\n\t}\n\n\tstaticCollConfig := extractStaticCollectionConfig(configInfo.CollectionConfig, collName)\n\tif staticCollConfig == nil {\n\t\treturn false, errors.Errorf(\"no collection config was found for collection %s for chaincode %s\", collName, ccName)\n\t}\n\n\tif !staticCollConfig.MemberOnlyRead {\n\t\treturn true, nil\n\t}\n\n\t// get collection access policy and access filter to check eligibility\n\tcollAP := &privdata.SimpleCollection{}\n\terr = collAP.Setup(staticCollConfig, deserializer)\n\tif err != nil {\n\t\treturn false, errors.WithMessagef(err, \"error setting up collection  %s\", staticCollConfig.Name)\n\t}\n\tlogger.Debugf(\"got collection access policy\")\n\n\tcollFilter := collAP.AccessFilter()\n\tif collFilter == nil {\n\t\tlogger.Debugf(\"collection %s has no access filter, skipping...\", collName)\n\t\treturn false, nil","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/peer/deliverevents.go#L459-L495","documentation":"CheckCollectionPolicy validates whether a client may read a private collection by looking up its most recent collection config below the given block sequence. If the collection config exists for the chaincode but contains no static configuration entry for the requested collection name, this error indicates the collection does not exist (or was never defined) for that chaincode.","triggerScenarios":"Calling CheckCollectionPolicy with a collName that has no entry in the chaincode's collection configuration at or below blockNum — i.e., reading a collection that was never defined, or a name mismatch (case/typo), or blockNum predating the collection's creation.","commonSituations":"Client requesting a renamed/typo'd collection; chaincode upgraded to add the collection but block number refers to a point before it existed; chaincode name mismatch (wrong ccName passed); collections_config.json missing the collection while chaincode still deployed.","solutions":["Verify the collection name in the request exactly matches an entry in the chaincode's collections_config.json.","Ensure blockNum is at or after the block where the collection config was committed.","Confirm the chaincode name matches the chaincode that owns the collection.","Redeploy/upgrade the chaincode with a collection config containing the collection if it was never defined."],"exampleFix":"// before\nok, err := checker.CheckCollectionPolicy(collPvtRWSet, \"mycc\", \"coll_wrong\", 10)\n// after\nok, err := checker.CheckCollectionPolicy(collPvtRWSet, \"mycc\", \"collectionOne\", 10) // name as defined in collections_config.json","handlingStrategy":"validation","validationCode":"if extractStaticCollectionConfig(configInfo.CollectionConfig, collName) == nil {\n  return fmt.Errorf(\"collection %s undefined for %s\", collName, ccName)\n}","typeGuard":null,"tryCatchPattern":"ok, err := checker.CheckCollectionPolicy(set, ccName, collName, blockNum)\nif err != nil && strings.Contains(err.Error(), \"no collection config was found\") {\n  return fmt.Errorf(\"collection %s not defined for %s: %w\", collName, ccName, err)\n}","preventionTips":["Define every collection used in collections_config.json","Use shared constants for collection names","Confirm collection existed at requested block sequence"],"tags":["private-data","collections","policy","hyperledger-fabric"],"backgroundTag":"collection-not-defined","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"}