{"record":{"id":"7747f0094d62a729","repo":"hyperledger/fabric","slug":"no-collection-config-was-found-for-collection-s-f-7747f0","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":"gossip/privdata/reconcile.go","lineNumber":249,"sourceCode":"}\n\nfunc (r *Reconciler) getMostRecentCollectionConfig(chaincodeName string, collectionName string, blockNum uint64) (*peer.StaticCollectionConfig, error) {\n\tconfigHistoryRetriever, err := r.GetConfigHistoryRetriever()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"configHistoryRetriever is not available\")\n\t}\n\n\tconfigInfo, err := configHistoryRetriever.MostRecentCollectionConfigBelow(blockNum, chaincodeName)\n\tif err != nil {\n\t\treturn nil, errors.New(fmt.Sprintf(\"cannot find recent collection config update below block sequence = %d for chaincode %s\", blockNum, chaincodeName))\n\t}\n\tif configInfo == nil {\n\t\treturn nil, errors.New(fmt.Sprintf(\"no collection config update below block sequence = %d for chaincode %s is available\", blockNum, chaincodeName))\n\t}\n\n\tcollectionConfig := extractCollectionConfig(configInfo.CollectionConfig, collectionName)\n\tif collectionConfig == nil {\n\t\treturn nil, errors.New(fmt.Sprintf(\"no collection config was found for collection %s for chaincode %s\", collectionName, chaincodeName))\n\t}\n\n\tstaticCollectionConfig, wasCastingSuccessful := collectionConfig.Payload.(*peer.CollectionConfig_StaticCollectionConfig)\n\tif !wasCastingSuccessful {\n\t\treturn nil, errors.New(fmt.Sprintf(\"expected collection config of type CollectionConfig_StaticCollectionConfig for collection %s for chaincode %s, while got different config type...\", collectionName, chaincodeName))\n\t}\n\treturn staticCollectionConfig.StaticCollectionConfig, nil\n}\n\nfunc (r *Reconciler) preparePvtDataToCommit(elements []*protosgossip.PvtDataElement) []*ledger.ReconciledPvtdata {\n\trwSetByBlockByKeys := r.groupRwsetByBlock(elements)\n\n\t// populate the private RWSets passed to the ledger\n\tvar pvtDataToCommit []*ledger.ReconciledPvtdata\n\n\tfor blockNum, rwSetKeys := range rwSetByBlockByKeys {\n\t\tblockPvtData := &ledger.ReconciledPvtdata{\n\t\t\tBlockNum:  blockNum,","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/gossip/privdata/reconcile.go#L231-L267","documentation":"A collection config update record was found, but the specific collectionName is not present among the collection configs in that update's CollectionConfig payload. extractCollectionConfig returned nil, so the reconciler cannot map the digest to a collection config.","triggerScenarios":"getMostRecentCollectionConfig (via getDig2CollectionConfig) when the most recent config update below blockNum exists but does not contain an entry for collectionName of chaincodeName.","commonSituations":"Typo in the collection name in queries or collection JSON; collection was added in a later config update than the one found below blockNum; reconciling very old missing data whose collection was defined later; chaincode upgraded with a renamed collection.","solutions":["Check the collection name against the chaincode's collections_config.json for exact spelling.","Confirm the collection existed at the block being reconciled; if it was added later, that old data cannot be reconciled via this config.","Redeploy/upgrade the chaincode with the correct collection definition.","Review chaincode lifecycle history to see when the collection was introduced."],"exampleFix":"// before\npeer chaincode query collections-config ...\n// collection 'priv' not listed\n// after: fix collections_config.json and upgrade chaincode\n{\n  \"name\": \"priv\",\n  \"policy\": \"OR('Org1MSP.member','Org2MSP.member')\",\n  \"requiredPeerCount\": 1,\n  \"maxPeerCount\": 2\n}","handlingStrategy":"validation","validationCode":"// cross-check collection names against the deployed collections config\ncollections, err := loadCollectionsConfig(\"collections_config.json\")\nif err != nil || !contains(collections, collectionName) {\n    log.Warningf(\"collection %s not defined for chaincode %s\", collectionName, chaincodeName)\n}","typeGuard":null,"tryCatchPattern":"cfg, err := r.getMostRecentCollectionConfig(cc, coll, blockNum)\nif err != nil {\n    if strings.Contains(err.Error(), \"no collection config was found for collection\") {\n        log.Warningf(\"unknown collection %s for %s; skipping dig\", coll, cc)\n        return\n    }\n    return err\n}","preventionTips":["Copy collection names from the exact collections_config.json, never by hand.","Version-control collection definitions and validate them in CI.","Check when each collection was introduced relative to the blocks being reconciled.","After chaincode upgrades, re-verify collection names before issuing pulls."],"tags":["hyperledger-fabric","gossip","collection-config"],"backgroundTag":"collection-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"}