hyperledger/fabric · error

collection-name: %s -- maximum peer count (%d) cannot be les

Error message

collection-name: %s -- maximum peer count (%d) cannot be less than the required peer count (%d)

What it means

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.

Source

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

		// 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)
		}
	}
	return nil
}

// validateSpOrConcat checks if the supplied signature policy is just an OR-concatenation of identities
func validateSpOrConcat(sp *common.SignaturePolicy) error {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Set maximumPeerCount to a value greater than or equal to requiredPeerCount in the collection config JSON/protobuf
  2. Review each collection entry and ensure the invariant maximumPeerCount >= requiredPeerCount >= 0 before submitting the transaction
  3. If using a template, fix the ordering of the maxPeerCount/requiredPeerCount fields, which are commonly inverted

Example fix

// before
{"name": "coll1", "requiredPeerCount": 3, "maxPeerCount": 2}
// after
{"name": "coll1", "requiredPeerCount": 2, "maxPeerCount": 3}
Defensive patterns

Strategy: validation

Validate before calling

function validateCollectionConfig(c) {
  if (c.maxPeerCount < c.requiredPeerCount) {
    throw new Error(`collection ${c.name}: maxPeerCount (${c.maxPeerCount}) must be >= requiredPeerCount (${c.requiredPeerCount})`);
  }
}

Type guard

function hasValidPeerCounts(c) {
  return typeof c.maxPeerCount === 'number' &&
         typeof c.requiredPeerCount === 'number' &&
         c.maxPeerCount >= c.requiredPeerCount;
}

Try / catch

try {
  await contract.submitTransaction('DeployChaincode', ...args);
} catch (err) {
  if (String(err).includes('maximum peer count')) {
    // fix collection config and resubmit
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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