{"record":{"id":"43a24ca962d33efa","repo":"hyperledger/fabric","slug":"invalid-passed-msp-it-must-be-different-from-nil","errorCode":null,"errorMessage":"Invalid passed MSP. It must be different from nil.","messagePattern":"Invalid passed MSP\\. It must be different from nil\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"msp/cache/cache.go","lineNumber":27,"sourceCode":"import (\n\t\"github.com/hyperledger/fabric-lib-go/common/flogging\"\n\tpmsp \"github.com/hyperledger/fabric-protos-go-apiv2/msp\"\n\t\"github.com/hyperledger/fabric/msp\"\n\t\"github.com/pkg/errors\"\n)\n\nconst (\n\tdeserializeIdentityCacheSize = 100\n\tvalidateIdentityCacheSize    = 100\n\tsatisfiesPrincipalCacheSize  = 100\n)\n\nvar mspLogger = flogging.MustGetLogger(\"msp\")\n\nfunc New(o msp.MSP) (msp.MSP, error) {\n\tmspLogger.Debugf(\"Creating Cache-MSP instance\")\n\tif o == nil {\n\t\treturn nil, errors.Errorf(\"Invalid passed MSP. It must be different from nil.\")\n\t}\n\n\ttheMsp := &cachedMSP{MSP: o}\n\ttheMsp.deserializeIdentityCache = newSecondChanceCache(deserializeIdentityCacheSize)\n\ttheMsp.satisfiesPrincipalCache = newSecondChanceCache(satisfiesPrincipalCacheSize)\n\ttheMsp.validateIdentityCache = newSecondChanceCache(validateIdentityCacheSize)\n\n\treturn theMsp, nil\n}\n\ntype cachedMSP struct {\n\tmsp.MSP\n\n\t// cache for DeserializeIdentity.\n\tdeserializeIdentityCache *secondChanceCache\n\n\t// cache for validateIdentity\n\tvalidateIdentityCache *secondChanceCache","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/msp/cache/cache.go#L9-L45","documentation":"Returned by msp/cache.New when the wrapped MSP argument is nil. The caching decorator has nothing to cache in front of, so it refuses construction — callers must pass an already-initialized MSP instance.","triggerScenarios":"Thrown at msp/cache/cache.go:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an initialized msp.MSP instance (e.g., from factory New) to New","Fix the caller that constructs the cache before the underlying MSP exists"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}