hyperledger/fabric · error
expected collection config of type CollectionConfig_StaticCo
Error message
expected collection config of type CollectionConfig_StaticCollectionConfig for collection %s for chaincode %s, while got different config type...
What it means
The collection config entry found in the config history is a CollectionConfig oneof whose Payload is not a CollectionConfig_StaticCollectionConfig. The reconciler only supports static collections, so it rejects any other payload type (e.g. future/dynamic collection types) with this error.
Source
Thrown at gossip/privdata/reconcile.go:254
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 {
rwSetByBlockByKeys := r.groupRwsetByBlock(elements)
// populate the private RWSets passed to the ledger
var pvtDataToCommit []*ledger.ReconciledPvtdata
for blockNum, rwSetKeys := range rwSetByBlockByKeys {
blockPvtData := &ledger.ReconciledPvtdata{
BlockNum: blockNum,
WriteSets: make(map[uint64]*ledger.TxPvtData),
}
for seqInBlock, nsRWS := range rwSetKeys.bySeqsInBlock() {
rwsets := nsRWS.toRWSet()
r.logger.Debugf("Preparing to commit [%d] private write set, missed from transaction index [%d] of block number [%d]", len(rwsets.NsPvtRwset), seqInBlock, blockNum)View on GitHub (pinned to 2736b63f8f)
Solutions
- Use only static collections in collection definitions; convert to static collections and upgrade the chaincode.
- Ensure all peers run a Fabric version that agrees with the stored config protobufs (avoid mixed-version config writes).
- Inspect the stored collection config payload to confirm the actual payload type.
- Upgrade the peer binary if a newer release adds support for the payload type.
Defensive patterns
Strategy: type-guard
Validate before calling
if cfg, ok := collectionConfig.Payload.(*peer.CollectionConfig_StaticCollectionConfig); !ok {
log.Warningf("unsupported collection config type %T; skipping", collectionConfig.Payload)
return
} Type guard
func isStaticCollectionConfig(cc *peer.CollectionConfig) (*peer.StaticCollectionConfig, bool) {
s, ok := cc.GetPayload().(*peer.CollectionConfig_StaticCollectionConfig)
if !ok {
return nil, false
}
return s.StaticCollectionConfig, true
} Try / catch
staticCfg, ok := isStaticCollectionConfig(collectionConfig)
if !ok {
return nil, fmt.Errorf("unsupported collection config type for collection %s", collectionName)
} Prevention
- Define only static collections in collection configs.
- Keep all peers on a Fabric version that understands the stored config protobufs.
- Avoid mixed-version writes to config history during rolling upgrades.
- Log %T of unexpected payloads to aid diagnosis.
When it happens
Trigger: getMostRecentCollectionConfig (via getDig2CollectionConfig) when the type assertion collectionConfig.Payload.(*peer.CollectionConfig_StaticCollectionConfig) fails for the retrieved collection config entry.
Common situations: A collection config in the ledger uses a non-static collection type (not supported by this Fabric version's reconciler), or a protobuf produced by a newer Fabric version is stored in config history and read by an older peer.
Related errors
- block from orderer could not be re-marshaled: proto: Marshal
- cannot find recent collection config update below block sequ
- no collection config update below block sequence = %d for ch
- no collection config was found for collection %s for chainco
- Undefined tag
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/71b6d6e881ccc6f3.
Report an issue: GitHub.