{"record":{"id":"0ebe58c4090ab6bc","repo":"hyperledger/fabric","slug":"could-not-obtain-collection-access-policy-collect","errorCode":null,"errorMessage":"Could not obtain collection access policy, collection name %s due to %s","messagePattern":"Could not obtain collection access policy, collection name (.+?) due to (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gossip/privdata/distributor.go","lineNumber":180,"sourceCode":"\t\tnamespace := pvtRwset.Namespace\n\t\tconfigPackage, found := privDataWithConfig.CollectionConfigs[namespace]\n\t\tif !found {\n\t\t\td.logger.Error(\"Collection config package for\", namespace, \"chaincode is not provided\")\n\t\t\treturn nil, errors.New(fmt.Sprint(\"collection config package for\", namespace, \"chaincode is not provided\"))\n\t\t}\n\n\t\tfor _, collection := range pvtRwset.CollectionPvtRwset {\n\t\t\tcolCP, err := d.getCollectionConfig(configPackage, collection)\n\t\t\tcollectionName := collection.CollectionName\n\t\t\tif err != nil {\n\t\t\t\td.logger.Error(\"Could not find collection access policy for\", namespace, \" and collection\", collectionName, \"error\", err)\n\t\t\t\treturn nil, errors.WithMessage(err, fmt.Sprint(\"could not find collection access policy for\", namespace, \" and collection\", collectionName, \"error\", err))\n\t\t\t}\n\n\t\t\tcolAP, err := d.AccessPolicy(colCP, d.chainID)\n\t\t\tif err != nil {\n\t\t\t\td.logger.Error(\"Could not obtain collection access policy, collection name\", collectionName, \"due to\", err)\n\t\t\t\treturn nil, errors.Wrap(err, fmt.Sprint(\"Could not obtain collection access policy, collection name\", collectionName, \"due to\", err))\n\t\t\t}\n\n\t\t\tcolFilter := colAP.AccessFilter()\n\t\t\tif colFilter == nil {\n\t\t\t\td.logger.Error(\"Collection access policy for\", collectionName, \"has no filter\")\n\t\t\t\treturn nil, errors.Errorf(\"No collection access policy filter computed for %v\", collectionName)\n\t\t\t}\n\n\t\t\tpvtDataMsg, err := d.createPrivateDataMessage(txID, namespace, collection, &peer.CollectionConfigPackage{Config: []*peer.CollectionConfig{colCP}}, blkHt)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.WithStack(err)\n\t\t\t}\n\n\t\t\td.logger.Debugf(\"Computing dissemination plan for collection [%s]\", collectionName)\n\t\t\tdPlan, err := d.disseminationPlanForMsg(colAP, colFilter, pvtDataMsg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.WithMessagef(err, \"could not build private data dissemination plan for chaincode %s and collection %s\", namespace, collectionName)\n\t\t\t}","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/gossip/privdata/distributor.go#L162-L198","documentation":"After locating the collection config, the distributor calls AccessPolicy to build a collection access policy. If that call returns an error (policy cannot be constructed from the config for this channel), computeDisseminationPlan wraps and returns it.","triggerScenarios":"AccessPolicy(colCP, chainID) returns an error while computing the dissemination plan — malformed static collection config, unresolved member orgs policy, or MSP/channel context failure resolving policy members.","commonSituations":"Collection config references organizations not in the channel MSP; invalid signature policy in the collection definition; policy evaluation fails due to missing MSP manager for the channel.","solutions":["Inspect the wrapped inner error (%s due to %s) to find the policy construction failure","Fix the collection definition (member_orgs_policy / signature policy) and upgrade the chaincode collection config","Verify all orgs named in the collection config are defined in the channel MSP"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// validate member orgs in collection config exist in channel MSP before use\ncfg, err := collectionStore.AccessFilter(channel, config.MemberOrgsPolicy)\nif err != nil || cfg == nil { /* skip or fix config */ }","typeGuard":null,"tryCatchPattern":"if err := distribute(...); err != nil {\n  if strings.Contains(err.Error(), \"Could not obtain collection access policy\") {\n    // inspect wrapped cause, fix collection config / MSP\n  }\n}","preventionTips":["Keep collection member orgs aligned with channel MSP definitions","Validate collection configs with configtxgen/chaincode upgrade checks"],"tags":["hyperledger-fabric","gossip","private-data","access-policy"],"backgroundTag":"collection-policy-error","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"}