hyperledger/fabric · error
required chaincodes are not installed on sufficient peers
Error message
required chaincodes are not installed on sufficient peers
What it means
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.
Source
Thrown at discovery/endorsement/endorsement.go:188
layouts := computeLayouts(ctx.principalsSets, principalGroups, satGraph)
if len(layouts) == 0 {
return nil, errors.New("no peer combination can satisfy the endorsement policy")
}
criteria := &peerMembershipCriteria{
possibleLayouts: layouts,
satGraph: satGraph,
chanMemberById: ctx.channelMembersById,
idOfMembers: ctx.identitiesOfMembers,
chaincodeMapping: ctx.chaincodeMapping,
}
groupToEndorserListMapping := endorsersByGroup(criteria)
layouts = filterOutUnsatisfiedLayouts(groupToEndorserListMapping, layouts)
if len(layouts) == 0 {
return nil, errors.New("required chaincodes are not installed on sufficient peers")
}
return &discovery.EndorsementDescriptor{
Chaincode: ctx.chaincode,
Layouts: layouts,
EndorsersByGroups: groupToEndorserListMapping,
}, nil
}
func filterOutUnsatisfiedLayouts(endorsersByGroup map[string]*discovery.Peers, layouts []*discovery.Layout) []*discovery.Layout {
// Iterate once again over all layouts and ensure every layout has enough peers in the EndorsersByGroups
// as required by the quantity in the layout.
filteredLayouts := make([]*discovery.Layout, 0, len(layouts))
for _, layout := range layouts {
var layoutInvalid bool
for group, quantity := range layout.QuantitiesByGroup {
peerList := endorsersByGroup[group]
if peerList == nil || len(peerList.Peers) < int(quantity) {View on GitHub (pinned to 2736b63f8f)
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
Example fix
// before # only peer0 has the chaincode; policy requires Org1+Org2 peer lifecycle chaincode install mycc_v1.tar.gz # on peer0 only // after # install on every org's peers for p in peer0.org1 peer0.org2; do peer lifecycle chaincode install mycc_v1.tar.gz --peerAddresses $p:7051 done
Defensive patterns
Strategy: retry
Validate before calling
// verify chaincode installed on peers of all policy orgs
for _, peer := range policyPeers {
if !chaincodeInstalled(peer, chaincodeName, version) {
return fmt.Errorf("%s not installed on %s", chaincodeName, peer)
}
} Try / catch
desc, err := client.PeersForEndorsement(req)
if err != nil {
if strings.Contains(err.Error(), "not installed on sufficient peers") {
time.Sleep(backoff) // re-check after lifecycle install propagates
return client.PeersForEndorsement(req)
}
return nil, err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- chaincode definition for '%s' exists, but chaincode is not i
- could not get channel config for channel '%s'
- expected QueryResult of either ChaincodeQueryResult or Error
- expected a static collection but got %v instead
- collection %s doesn't exist in collection config for chainco
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/1c9bfff865c27927.
Report an issue: GitHub.