{"record":{"id":"b57b9c96ca6f8b53","repo":"hyperledger/fabric","slug":"identitydeserializer-not-passed-in-init","errorCode":null,"errorMessage":"identityDeserializer not passed in init","messagePattern":"identityDeserializer not passed in init","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/default_validation.go","lineNumber":131,"sourceCode":"\t\t}\n\t\tif capabilities, isCapabilities := dep.(vc.Capabilities); isCapabilities {\n\t\t\tc = capabilities\n\t\t}\n\t\tif stateFetcher, isStateFetcher := dep.(vs.StateFetcher); isStateFetcher {\n\t\t\tsf = stateFetcher\n\t\t}\n\t\tif policyEvaluator, isPolicyFetcher := dep.(vp.PolicyEvaluator); isPolicyFetcher {\n\t\t\tpe = policyEvaluator\n\t\t}\n\t\tif collectionResources, isCollectionResources := dep.(plugindispatcher.CollectionResources); isCollectionResources {\n\t\t\tcor = collectionResources\n\t\t}\n\t}\n\tif sf == nil {\n\t\treturn errors.New(\"stateFetcher not passed in init\")\n\t}\n\tif d == nil {\n\t\treturn errors.New(\"identityDeserializer not passed in init\")\n\t}\n\tif c == nil {\n\t\treturn errors.New(\"capabilities not passed in init\")\n\t}\n\tif pe == nil {\n\t\treturn errors.New(\"policy fetcher not passed in init\")\n\t}\n\tif cor == nil {\n\t\treturn errors.New(\"collection resources not passed in init\")\n\t}\n\n\tv.Capabilities = c\n\tv.TxValidatorV1_2 = v12.New(c, sf, d, pe)\n\tv.TxValidatorV1_3 = v13.New(c, sf, d, pe)\n\tv.TxValidatorV2_0 = v20.New(c, sf, d, pe, cor)\n\n\treturn nil\n}","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/default_validation.go#L113-L149","documentation":"Init() returns this error when the identityDeserializer dependency is nil. The validator must deserialize transaction creators' identities (msp identities) from the envelope to build the signature set for endorsement policy evaluation, so a deserializer is mandatory. Initialization aborts before the handler processes any blocks.","triggerScenarios":"Calling Init() with d == nil: constructing the built-in validation handler without an IdentityDeserializer in the dependency set.","commonSituations":"Custom plugin wiring that supplies the state fetcher but forgets the identity deserializer; misordered DI initialization; mocked dependencies in tests missing one field.","solutions":["Provide a valid IdentityDeserializer (e.g. mspmgmt-based deserializer) in the dependencies passed to Init()","Verify the wiring/factory code sets every required dependency: sf, d, c, pe, cor","Fix any unit test fixtures to include a deserializer (a stub is acceptable)"],"exampleFix":"// before\nerr := handler.Init(sf, nil, capabilities, policyEvaluator, collectionResources)\n// after\nd := &identity.MSPIdentityDeserializer{}\nerr := handler.Init(sf, d, capabilities, policyEvaluator, collectionResources)","handlingStrategy":"validation","validationCode":"if d == nil {\n    return errors.New(\"cannot init validation handler: IdentityDeserializer dependency is nil\")\n}\nerr := handler.Init(sf, d, c, pe, cor)","typeGuard":"func depsComplete(d IdentityDeserializer) bool { return d != nil }","tryCatchPattern":null,"preventionTips":["Centralize dependency assembly so IdentityDeserializer is never omitted","Add smoke tests that run Init with the production dependency set","Keep deserializer wiring alongside MSP initialization to preserve ordering"],"tags":["go","initialization","dependency-injection","identity"],"backgroundTag":"missing-dependency-in-init","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"}