{"record":{"id":"1c9bfff865c27927","repo":"hyperledger/fabric","slug":"required-chaincodes-are-not-installed-on-sufficien","errorCode":null,"errorMessage":"required chaincodes are not installed on sufficient peers","messagePattern":"required chaincodes are not installed on sufficient peers","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/endorsement/endorsement.go","lineNumber":188,"sourceCode":"\n\tlayouts := computeLayouts(ctx.principalsSets, principalGroups, satGraph)\n\tif len(layouts) == 0 {\n\t\treturn nil, errors.New(\"no peer combination can satisfy the endorsement policy\")\n\t}\n\n\tcriteria := &peerMembershipCriteria{\n\t\tpossibleLayouts:  layouts,\n\t\tsatGraph:         satGraph,\n\t\tchanMemberById:   ctx.channelMembersById,\n\t\tidOfMembers:      ctx.identitiesOfMembers,\n\t\tchaincodeMapping: ctx.chaincodeMapping,\n\t}\n\n\tgroupToEndorserListMapping := endorsersByGroup(criteria)\n\tlayouts = filterOutUnsatisfiedLayouts(groupToEndorserListMapping, layouts)\n\n\tif len(layouts) == 0 {\n\t\treturn nil, errors.New(\"required chaincodes are not installed on sufficient peers\")\n\t}\n\n\treturn &discovery.EndorsementDescriptor{\n\t\tChaincode:         ctx.chaincode,\n\t\tLayouts:           layouts,\n\t\tEndorsersByGroups: groupToEndorserListMapping,\n\t}, nil\n}\n\nfunc filterOutUnsatisfiedLayouts(endorsersByGroup map[string]*discovery.Peers, layouts []*discovery.Layout) []*discovery.Layout {\n\t// Iterate once again over all layouts and ensure every layout has enough peers in the EndorsersByGroups\n\t// as required by the quantity in the layout.\n\tfilteredLayouts := make([]*discovery.Layout, 0, len(layouts))\n\tfor _, layout := range layouts {\n\t\tvar layoutInvalid bool\n\t\tfor group, quantity := range layout.QuantitiesByGroup {\n\t\t\tpeerList := endorsersByGroup[group]\n\t\t\tif peerList == nil || len(peerList.Peers) < int(quantity) {","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/endorsement/endorsement.go#L170-L206","documentation":"After layouts are computed, discovery filters out layouts whose peer groups have no installed/available endorsers. If every layout is eliminated because the required chaincode (or collection principals) is not satisfied by enough peers' installed chaincode binaries, computeEndorsementResponse returns this error instead of an empty descriptor.","triggerScenarios":"Peers satisfy the endorsement policy principals but the chaincode package is not installed (or wrong version) on them, so endorsersByGroup yields nothing usable; collections required peers lack the chaincode.","commonSituations":"Chaincode installed on some peers only while the policy spans others; peers upgraded to a new chaincode version while others lag; freshly joined peers missing chaincode packages; lifecycle approve/commit done but install skipped on a peer.","solutions":["Install the chaincode package on all peers referenced by the endorsement policy (peer lifecycle chaincode install)","Verify installed chaincode version matches the committed definition on every peer","Lower/adjust the endorsement policy or layout requirements to match the peers that have the chaincode installed","Re-run discovery after installation completes"],"exampleFix":"// before\n# only peer0 has the chaincode; policy requires Org1+Org2\npeer lifecycle chaincode install mycc_v1.tar.gz   # on peer0 only\n\n// after\n# install on every org's peers\nfor p in peer0.org1 peer0.org2; do\n  peer lifecycle chaincode install mycc_v1.tar.gz --peerAddresses $p:7051\ndone","handlingStrategy":"retry","validationCode":"// verify chaincode installed on peers of all policy orgs\nfor _, peer := range policyPeers {\n    if !chaincodeInstalled(peer, chaincodeName, version) {\n        return fmt.Errorf(\"%s not installed on %s\", chaincodeName, peer)\n    }\n}","typeGuard":null,"tryCatchPattern":"desc, err := client.PeersForEndorsement(req)\nif err != nil {\n    if strings.Contains(err.Error(), \"not installed on sufficient peers\") {\n        time.Sleep(backoff) // re-check after lifecycle install propagates\n        return client.PeersForEndorsement(req)\n    }\n    return nil, err\n}","preventionTips":["Install chaincode packages on every peer referenced by the endorsement policy","Keep chaincode versions consistent across peers after upgrades","Add lifecycle install steps to new-peer provisioning runbooks","Verify installs with peer lifecycle chaincode queryinstalled before discovery-dependent operations"],"tags":["discovery","endorsement","chaincode-lifecycle"],"backgroundTag":"chaincode-not-installed","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"}