hyperledger/fabric · error

cannot find recent collection config update below block sequ

Error message

cannot find recent collection config update below block sequence = %d for chaincode %s

What it means

After obtaining the configHistoryRetriever, MostRecentCollectionConfigBelow(blockNum, chaincodeName) failed, meaning no recorded collection config update event exists below the given block sequence for that chaincode in the config history index. The reconciler cannot determine the collection config for the missing private data it wants to pull.

Source

Thrown at gossip/privdata/reconcile.go:241

					Namespace:  pvtDataInfo.Namespace,
					BlockSeq:   blockNum,
				}
				dig2collectionCfg[digKey] = collectionConfigCache[collConfigKey]
			}
		}
	}
	return dig2collectionCfg, minBlock, maxBlock
}

func (r *Reconciler) getMostRecentCollectionConfig(chaincodeName string, collectionName string, blockNum uint64) (*peer.StaticCollectionConfig, error) {
	configHistoryRetriever, err := r.GetConfigHistoryRetriever()
	if err != nil {
		return nil, errors.Wrap(err, "configHistoryRetriever is not available")
	}

	configInfo, err := configHistoryRetriever.MostRecentCollectionConfigBelow(blockNum, chaincodeName)
	if err != nil {
		return nil, errors.New(fmt.Sprintf("cannot find recent collection config update below block sequence = %d for chaincode %s", blockNum, chaincodeName))
	}
	if configInfo == nil {
		return nil, errors.New(fmt.Sprintf("no collection config update below block sequence = %d for chaincode %s is available", blockNum, chaincodeName))
	}

	collectionConfig := extractCollectionConfig(configInfo.CollectionConfig, collectionName)
	if collectionConfig == nil {
		return nil, errors.New(fmt.Sprintf("no collection config was found for collection %s for chaincode %s", collectionName, chaincodeName))
	}

	staticCollectionConfig, wasCastingSuccessful := collectionConfig.Payload.(*peer.CollectionConfig_StaticCollectionConfig)
	if !wasCastingSuccessful {
		return nil, errors.New(fmt.Sprintf("expected collection config of type CollectionConfig_StaticCollectionConfig for collection %s for chaincode %s, while got different config type...", collectionName, chaincodeName))
	}
	return staticCollectionConfig.StaticCollectionConfig, nil
}

func (r *Reconciler) preparePvtDataToCommit(elements []*protosgossip.PvtDataElement) []*ledger.ReconciledPvtdata {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Verify the chaincode defines the collection and that a collection config update was committed on the channel.
  2. Ensure the peer's ledger includes blocks at/below the config update (peer joined from genesis or a snapshot covering the update).
  3. Check the configHistory ledger index for corruption; rebuild the peer ledger if needed.
  4. Confirm you query with the correct chaincode name and block number.
Defensive patterns

Strategy: validation

Validate before calling

// verify chaincode/collection exist in channel definition before reconciling
collectionJSON, _ := exec.Command("peer", "chaincode", "list", "collections",
    "-C", channelID, "--chaincode", chaincodeName).Output()
if len(collectionJSON) == 0 {
    log.Warningf("no collections defined for chaincode %s; skip reconcile", chaincodeName)
}

Try / catch

cfg, err := r.getMostRecentCollectionConfig(cc, coll, blockNum)
if err != nil {
    if strings.Contains(err.Error(), "cannot find recent collection config update") {
        log.Warningf("no config history for %s below block %d; skipping", cc, blockNum)
        return
    }
    return err
}

Prevention

When it happens

Trigger: getMostRecentCollectionConfig called (via getDig2CollectionConfig) for a chaincode/block combination where the config history index has no collection-config-update record below blockNum.

Common situations: Chaincode data exists in the ledger but its collection was never defined via a lifecycle config update; the peer joined the channel at a block after the config update so earlier config history is absent; corrupted config history index.

Related errors


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