hyperledger/fabric · error

no collection config was found for collection %s for chainco

Error message

no collection config was found for collection %s for chaincode %s

What it means

CheckCollectionPolicy validates whether a client may read a private collection by looking up its most recent collection config below the given block sequence. If the collection config exists for the chaincode but contains no static configuration entry for the requested collection name, this error indicates the collection does not exist (or was never defined) for that chaincode.

Source

Thrown at core/peer/deliverevents.go:477

type collPolicyChecker struct{}

// CheckCollectionPolicy checks if the CollectionCriteria meets the policy requirement
func (cs *collPolicyChecker) CheckCollectionPolicy(
	blockNum uint64,
	ccName string,
	collName string,
	cfgHistoryRetriever ledger.ConfigHistoryRetriever,
	deserializer msp.IdentityDeserializer,
	signedData *protoutil.SignedData,
) (bool, error) {
	configInfo, err := cfgHistoryRetriever.MostRecentCollectionConfigBelow(blockNum, ccName)
	if err != nil {
		return false, errors.WithMessagef(err, "error getting most recent collection config below block sequence = %d for chaincode %s", blockNum, ccName)
	}

	staticCollConfig := extractStaticCollectionConfig(configInfo.CollectionConfig, collName)
	if staticCollConfig == nil {
		return false, errors.Errorf("no collection config was found for collection %s for chaincode %s", collName, ccName)
	}

	if !staticCollConfig.MemberOnlyRead {
		return true, nil
	}

	// get collection access policy and access filter to check eligibility
	collAP := &privdata.SimpleCollection{}
	err = collAP.Setup(staticCollConfig, deserializer)
	if err != nil {
		return false, errors.WithMessagef(err, "error setting up collection  %s", staticCollConfig.Name)
	}
	logger.Debugf("got collection access policy")

	collFilter := collAP.AccessFilter()
	if collFilter == nil {
		logger.Debugf("collection %s has no access filter, skipping...", collName)
		return false, nil

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Verify the collection name in the request exactly matches an entry in the chaincode's collections_config.json.
  2. Ensure blockNum is at or after the block where the collection config was committed.
  3. Confirm the chaincode name matches the chaincode that owns the collection.
  4. Redeploy/upgrade the chaincode with a collection config containing the collection if it was never defined.

Example fix

// before
ok, err := checker.CheckCollectionPolicy(collPvtRWSet, "mycc", "coll_wrong", 10)
// after
ok, err := checker.CheckCollectionPolicy(collPvtRWSet, "mycc", "collectionOne", 10) // name as defined in collections_config.json
Defensive patterns

Strategy: validation

Validate before calling

if extractStaticCollectionConfig(configInfo.CollectionConfig, collName) == nil {
  return fmt.Errorf("collection %s undefined for %s", collName, ccName)
}

Try / catch

ok, err := checker.CheckCollectionPolicy(set, ccName, collName, blockNum)
if err != nil && strings.Contains(err.Error(), "no collection config was found") {
  return fmt.Errorf("collection %s not defined for %s: %w", collName, ccName, err)
}

Prevention

When it happens

Trigger: Calling CheckCollectionPolicy with a collName that has no entry in the chaincode's collection configuration at or below blockNum — i.e., reading a collection that was never defined, or a name mismatch (case/typo), or blockNum predating the collection's creation.

Common situations: Client requesting a renamed/typo'd collection; chaincode upgraded to add the collection but block number refers to a point before it existed; chaincode name mismatch (wrong ccName passed); collections_config.json missing the collection while chaincode still deployed.

Related errors


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