hyperledger/fabric · error

collection-name: %s -- found duplicate collection configurat

Error message

collection-name: %s -- found duplicate collection configuration

What it means

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.

Source

Thrown at core/handlers/validation/builtin/v13/lscc_validation_logic.go:79

	// 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 (%d)",
				collectionName, maximumPeerCount, 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

  1. Deduplicate the collections config so each name appears exactly once before submitting the upgrade
  2. Review collections.json for repeated "name" fields and remove or rename duplicates
  3. Adopt unique, org-scoped naming conventions for collections to avoid collisions

Example fix

// before
[{"name":"col1",...},{"name":"col1",...}]
// after
[{"name":"col1",...},{"name":"col2",...}]
Defensive patterns

Strategy: validation

Validate before calling

const names = collections.map(c => c.name);
const dupes = names.filter((n, i) => names.indexOf(n) !== i);
if (dupes.length) {
  throw new Error(`Duplicate collection names in config: ${[...new Set(dupes)].join(',')}`);
}

Try / catch

try {
  await upgradeContract.submitTransaction(..., collectionJson);
} catch (e) {
  if (String(e).includes('found duplicate collection configuration')) {
    // dedupe collections.json by name and resubmit
  }
}

Prevention

When it happens

Trigger: An lscc UPGRADE whose rwset contains two CollectionConfigs with the identical collection name, validated via validateRWSetAndCollection.

Common situations: Merged collections.json files where two entries share a name; copy-paste in collection config JSON; tooling regenerating configs without deduplicating names.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/ea13810b768f35c1. Report an issue: GitHub.