{"record":{"id":"1ed222e876e128a3","repo":"hyperledger/fabric","slug":"collection-name-s-requiredpeercount-d-cann-1ed222","errorCode":null,"errorMessage":"collection-name: %s -- requiredPeerCount (%d) cannot be less than zero","messagePattern":"collection-name: (.+?) -- requiredPeerCount \\((.+?)\\) cannot be less than zero","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v12/validation_logic.go","lineNumber":233,"sourceCode":"\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\",\n\t\t\t\tcollectionName, 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 {\n\tif sp.GetNOutOf() == nil {\n\t\treturn nil\n\t}\n\t// check if N == 1 (OR concatenation)","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v12/validation_logic.go#L215-L251","documentation":"validateNewCollectionConfigs found a collection with a negative RequiredPeerCount. RequiredPeerCount is a dissemination floor and must be zero or positive; -1 is only valid for MaximumPeerCount (meaning unlimited).","triggerScenarios":"Thrown at core/handlers/validation/builtin/v12/validation_logic.go:233 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set requiredPeerCount to 0 or a positive integer","Use maximumPeerCount=-1 for unlimited dissemination instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}