hyperledger/fabric · error

collection configuration arguments supplied for chaincode %s

Error message

collection configuration arguments supplied for chaincode %s:%s do not match the configuration in the lscc writeset

What it means

The collection configuration passed as an LSCC deploy/upgrade argument differs byte-wise from the collection config written to the ledger write-set. VSCC requires the declared args and the actual writes to agree exactly.

Source

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

	/**********************************************************/
	var collectionsConfigArg []byte
	if len(lsccArgs) > 5 {
		collectionsConfigArg = lsccArgs[5]
	}

	var collectionsConfigLedger []byte
	if len(lsccrwset.Writes) == 2 {
		key := privdata.BuildCollectionKVSKey(cdRWSet.Name)
		if lsccrwset.Writes[1].Key != key {
			return policyErr(fmt.Errorf("invalid key for the collection of chaincode %s:%s; expected '%s', received '%s'",
				cdRWSet.Name, cdRWSet.Version, key, lsccrwset.Writes[1].Key))
		}

		collectionsConfigLedger = lsccrwset.Writes[1].Value
	}

	if !bytes.Equal(collectionsConfigArg, collectionsConfigLedger) {
		return policyErr(fmt.Errorf("collection configuration arguments supplied for chaincode %s:%s do not match the configuration in the lscc writeset",
			cdRWSet.Name, cdRWSet.Version))
	}

	channelState, err := vscc.stateFetcher.FetchState()
	if err != nil {
		return &commonerrors.VSCCExecutionFailureError{Err: fmt.Errorf("failed obtaining query executor: %v", err)}
	}
	defer channelState.Done()

	state := &state{channelState}

	// The following condition check added in v1.1 may not be needed as it is not possible to have the chaincodeName~collection key in
	// the lscc namespace before a chaincode deploy. To avoid forks in v1.2, the following condition is retained.
	if lsccFunc == lscc.DEPLOY {
		colCriteria := privdata.CollectionCriteria{Channel: channelName, Namespace: cdRWSet.Name}
		ccp, err := privdata.RetrieveCollectionConfigPackageFromState(colCriteria, state)
		if err != nil {
			// fail if we get any error other than NoSuchCollectionError

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Make the collections config argument identical to the value written by LSCC
  2. Rebuild and resubmit the deploy transaction with consistent collection bytes
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/handlers/validation/builtin/v13/lscc_validation_logic.go:255 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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