{"record":{"id":"3f600884c029b56a","repo":"hyperledger/fabric","slug":"unexpected-collection-type","errorCode":null,"errorMessage":"unexpected collection type","messagePattern":"unexpected collection type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/transientstore/store_helper.go","lineNumber":234,"sourceCode":"\nfunc trimPvtCollectionConfigs(configs map[string]*peer.CollectionConfigPackage,\n\tfilter ledger.PvtNsCollFilter,\n) (map[string]*peer.CollectionConfigPackage, error) {\n\tif filter == nil {\n\t\treturn configs, nil\n\t}\n\tresult := make(map[string]*peer.CollectionConfigPackage)\n\n\tfor ns, pkg := range configs {\n\t\tresult[ns] = &peer.CollectionConfigPackage{}\n\t\tfor _, colConf := range pkg.GetConfig() {\n\t\t\tswitch cconf := colConf.Payload.(type) {\n\t\t\tcase *peer.CollectionConfig_StaticCollectionConfig:\n\t\t\t\tif filter.Has(ns, cconf.StaticCollectionConfig.Name) {\n\t\t\t\t\tresult[ns].Config = append(result[ns].Config, colConf)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn nil, errors.New(\"unexpected collection type\")\n\t\t\t}\n\t\t}\n\t}\n\treturn result, nil\n}\n","sourceCodeStart":216,"sourceCodeEnd":240,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/transientstore/store_helper.go#L216-L240","documentation":"While iterating stored collection configs to trim private collection entries, each CollectionConfig payload is type-switched. Only *CollectionConfig_StaticCollectionConfig is supported; any other payload variant causes this error, since the transient store only understands static collections.","triggerScenarios":"Reading entries from the transient store (via Next()/retrieval with a filter) when a stored collection config message contains a payload type other than StaticCollectionConfig.","commonSituations":"Protobuf version mismatch between writer and reader (a collection config variant written by a newer/different Fabric version); corrupted transient store data.","solutions":["Regenerate/rebuild the transient store data (drop and recreate the store directory)","Align Fabric versions/protobuf definitions between peers writing and reading the store","Clear stale transient store files after a Fabric upgrade"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before reading the store, confirm all collection configs are static\ncconf := rawConf.GetCollectionConfig()\nif _, ok := cconf.Payload.(*peer.CollectionConfig_StaticCollectionConfig); !ok {\n    return errors.New(\"unsupported collection config type\")\n}","typeGuard":"func isStaticCollectionConfig(c *peer.CollectionConfig) bool {\n    _, ok := c.GetPayload().(*peer.CollectionConfig_StaticCollectionConfig)\n    return ok\n}","tryCatchPattern":"iter, err := store.GetTxPvtRWSetByTxid(txid, filter)\nif err != nil {\n    if strings.Contains(err.Error(), \"unexpected collection type\") {\n        // data written by incompatible Fabric version: rebuild transient store\n    }\n    return err\n}","preventionTips":["Keep all peers on the same Fabric version","Rebuild transient store after upgrades","Avoid custom collection config variants in patched builds","Validate collection configs at write time"],"tags":["fabric","transientstore","protobuf","collection-config"],"backgroundTag":"unexpected-protobuf-type","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}