{"record":{"id":"ea13810b768f35c1","repo":"hyperledger/fabric","slug":"collection-name-s-found-duplicate-collection-ea1381","errorCode":null,"errorMessage":"collection-name: %s -- found duplicate collection configuration","messagePattern":"collection-name: (.+?) -- found duplicate collection configuration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v13/lscc_validation_logic.go","lineNumber":79,"sourceCode":"\t// Process each collection config from a set of collection configs\n\tfor _, newCollectionConfig := range newCollectionConfigs {\n\n\t\tnewCollection := newCollectionConfig.GetStaticCollectionConfig()\n\t\tif newCollection == nil {\n\t\t\treturn errors.New(\"unknown collection configuration type\")\n\t\t}\n\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)","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v13/lscc_validation_logic.go#L61-L97","documentation":"A collection update set must not define two collections with the same name. VSCC's validateNewCollectionConfigs tracks names and rejects the transaction with this error when a duplicate is found, keeping the private-data collection namespace unambiguous.","triggerScenarios":"An lscc UPGRADE whose rwset contains two CollectionConfigs with the identical collection name, validated via validateRWSetAndCollection.","commonSituations":"Merged collections.json files where two entries share a name; copy-paste in collection config JSON; tooling regenerating configs without deduplicating names.","solutions":["Deduplicate the collections config so each name appears exactly once before submitting the upgrade","Review collections.json for repeated \"name\" fields and remove or rename duplicates","Adopt unique, org-scoped naming conventions for collections to avoid collisions"],"exampleFix":"// before\n[{\"name\":\"col1\",...},{\"name\":\"col1\",...}]\n// after\n[{\"name\":\"col1\",...},{\"name\":\"col2\",...}]","handlingStrategy":"validation","validationCode":"const names = collections.map(c => c.name);\nconst dupes = names.filter((n, i) => names.indexOf(n) !== i);\nif (dupes.length) {\n  throw new Error(`Duplicate collection names in config: ${[...new Set(dupes)].join(',')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await upgradeContract.submitTransaction(..., collectionJson);\n} catch (e) {\n  if (String(e).includes('found duplicate collection configuration')) {\n    // dedupe collections.json by name and resubmit\n  }\n}","preventionTips":["Deduplicate collection names before packaging the config","Lint collections.json with a schema check in CI","Use unique naming conventions per collection"],"tags":["hyperledger-fabric","private-data","collections","duplicate"],"backgroundTag":"duplicate-collection-name","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"}