hyperledger/fabric · error
collection-name: %s -- found duplicate collection configurat
Error message
collection-name: %s -- found duplicate collection configuration
What it means
During a collection configuration upgrade, two or more collection configs in the new package share the same collection name. Collection names must be unique within a chaincode's config, so the upgrade is rejected with the offending name in the message.
Source
Thrown at core/handlers/validation/builtin/v12/validation_logic.go:222
// Process each collection config from a set of collection configs
for _, newCollectionConfig := range newCollectionConfigs {
newCollection := newCollectionConfig.GetStaticCollectionConfig()
if newCollection == nil {
return errors.New("unknown collection configuration type")
}
// Ensure that there are no duplicate collection names
collectionName := newCollection.GetName()
if err := validateCollectionName(collectionName); err != nil {
return err
}
if _, ok := newCollectionsMap[collectionName]; !ok {
newCollectionsMap[collectionName] = true
} else {
return fmt.Errorf("collection-name: %s -- found duplicate collection configuration", collectionName)
}
// Validate gossip related parameters present in the collection config
maximumPeerCount := newCollection.GetMaximumPeerCount()
requiredPeerCount := newCollection.GetRequiredPeerCount()
if maximumPeerCount < requiredPeerCount {
return fmt.Errorf("collection-name: %s -- maximum peer count (%d) cannot be less than the required peer count (%d)",
collectionName, maximumPeerCount, requiredPeerCount)
}
if requiredPeerCount < 0 {
return fmt.Errorf("collection-name: %s -- requiredPeerCount (%d) cannot be less than zero",
collectionName, requiredPeerCount)
}
// make sure that the signature policy is meaningful (only consists of ORs)
err := validateSpOrConcat(newCollection.MemberOrgsPolicy.GetSignaturePolicy().Rule)
if err != nil {
return errors.WithMessagef(err, "collection-name: %s -- error in member org policy", collectionName)View on GitHub (pinned to 2736b63f8f)
Solutions
- Deduplicate collection names in the collections config file before issuing the chaincode upgrade
- If you intended to modify an existing collection, keep one entry with the updated parameters instead of adding a second entry with the same name
- Validate the JSON with a quick script (e.g. jq checking for duplicate .name values) before peer chaincode upgrade
Example fix
// before
[{"name":"col1",...},{"name":"col1",...}]
// after
[{"name":"col1",...},{"name":"col2",...}] Defensive patterns
Strategy: validation
Validate before calling
names := map[string]bool{}
for _, cfg := range collectionConfigPackage.Config {
sc := cfg.GetStaticCollectionConfig()
if sc != nil {
if names[sc.GetName()] {
return fmt.Errorf("duplicate collection name: %s", sc.GetName())
}
names[sc.GetName()] = true
}
} Prevention
- Run a duplicate-name lint on collections_config.json before upgrades
- Merge collection definitions from a single source of truth
- Keep a per-chaincode registry of existing collection names to avoid re-adding
When it happens
Trigger: Submitting an upgrade whose CollectionConfigPackage lists the same collection name twice (validateRWSetAndCollection -> validateNewCollectionConfigs detects the duplicate in newCollectionsMap).
Common situations: Copy-paste errors in collections_config.json; merging collection definitions from multiple files without dedup; automated tooling appending a collection that already exists in the config.
Related errors
- unknown collection configuration type
- config ID illegal, cannot be empty
- config ID illegal, cannot be longer than %d
- name '%s' for config ID is not allowed
- config ID '%s' contains illegal characters
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/19d707ec04cfd2af.
Report an issue: GitHub.