{"record":{"id":"ff1d522e15e9b4f2","repo":"hyperledger/fabric","slug":"collection-name-s-maximum-peer-count-d-can-ff1d52","errorCode":null,"errorMessage":"collection-name: %s -- maximum peer count (%d) cannot be less than the required peer count (%d)","messagePattern":"collection-name: (.+?) -- maximum peer count \\((.+?)\\) cannot be less than the required peer count \\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v13/lscc_validation_logic.go","lineNumber":86,"sourceCode":"\n\t\t// Ensure that there are no duplicate collection names\n\t\tcollectionName := newCollection.GetName()\n\n\t\tif err := validateCollectionName(collectionName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif _, ok := newCollectionsMap[collectionName]; !ok {\n\t\t\tnewCollectionsMap[collectionName] = true\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"collection-name: %s -- found duplicate collection configuration\", collectionName)\n\t\t}\n\n\t\t// Validate gossip related parameters present in the collection config\n\t\tmaximumPeerCount := newCollection.GetMaximumPeerCount()\n\t\trequiredPeerCount := newCollection.GetRequiredPeerCount()\n\t\tif maximumPeerCount < requiredPeerCount {\n\t\t\treturn fmt.Errorf(\"collection-name: %s -- maximum peer count (%d) cannot be less than the required peer count (%d)\",\n\t\t\t\tcollectionName, maximumPeerCount, requiredPeerCount)\n\t\t}\n\t\tif requiredPeerCount < 0 {\n\t\t\treturn fmt.Errorf(\"collection-name: %s -- requiredPeerCount (%d) cannot be less than zero (%d)\",\n\t\t\t\tcollectionName, maximumPeerCount, requiredPeerCount)\n\t\t}\n\n\t\t// make sure that the signature policy is meaningful (only consists of ORs)\n\t\terr := validateSpOrConcat(newCollection.MemberOrgsPolicy.GetSignaturePolicy().Rule)\n\t\tif err != nil {\n\t\t\treturn errors.WithMessagef(err, \"collection-name: %s -- error in member org policy\", collectionName)\n\t\t}\n\t}\n\treturn nil\n}\n\n// validateSpOrConcat checks if the supplied signature policy is just an OR-concatenation of identities\nfunc validateSpOrConcat(sp *common.SignaturePolicy) error {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v13/lscc_validation_logic.go#L68-L104","documentation":"This error is thrown during LSCC (lifecycle system chaincode) validation of a private data collection config when a collection's maximumPeerCount is set lower than its requiredPeerCount. maximumPeerCount is the maximum number of peers gossip will attempt to disseminate collection data to, and it must be greater than or equal to requiredPeerCount, the number of peers that must be available for the collection to be readable. fabric-core rejects the transaction in validateNewCollectionConfigs before it can commit.","triggerScenarios":"Submitting a chaincode define/collection-config update where a StaticCollectionConfig has GetMaximumPeerCount() < GetRequiredPeerCount(), e.g. requiredPeerCount=3 with maximumPeerCount=2, passed via --collections-config to lifecycle chaincode approveformyorg/commit or in the collection config protobuf.","commonSituations":"Hand-written collection JSON where the two numbers were swapped or typos in the values; copying a config and lowering maxPeerCount without lowering requiredPeerCount; tooling that computes maximumPeerCount independently of requiredPeerCount.","solutions":["Set maximumPeerCount to a value greater than or equal to requiredPeerCount in the collection config JSON/protobuf","Review each collection entry and ensure the invariant maximumPeerCount >= requiredPeerCount >= 0 before submitting the transaction","If using a template, fix the ordering of the maxPeerCount/requiredPeerCount fields, which are commonly inverted"],"exampleFix":"// before\n{\"name\": \"coll1\", \"requiredPeerCount\": 3, \"maxPeerCount\": 2}\n// after\n{\"name\": \"coll1\", \"requiredPeerCount\": 2, \"maxPeerCount\": 3}","handlingStrategy":"validation","validationCode":"function validateCollectionConfig(c) {\n  if (c.maxPeerCount < c.requiredPeerCount) {\n    throw new Error(`collection ${c.name}: maxPeerCount (${c.maxPeerCount}) must be >= requiredPeerCount (${c.requiredPeerCount})`);\n  }\n}","typeGuard":"function hasValidPeerCounts(c) {\n  return typeof c.maxPeerCount === 'number' &&\n         typeof c.requiredPeerCount === 'number' &&\n         c.maxPeerCount >= c.requiredPeerCount;\n}","tryCatchPattern":"try {\n  await contract.submitTransaction('DeployChaincode', ...args);\n} catch (err) {\n  if (String(err).includes('maximum peer count')) {\n    // fix collection config and resubmit\n  }\n  throw err;\n}","preventionTips":["Define a helper that builds collection configs enforcing maxPeerCount >= requiredPeerCount >= 0","Validate collections JSON with a JSON schema before every deploy/upgrade","Keep requiredPeerCount and maxPeerCount adjacent in config templates to avoid swaps"],"tags":["hyperledger-fabric","private-data","collection-config","validation"],"backgroundTag":"invalid-collection-config","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"}