{"record":{"id":"eca5671e9d5afc8b","repo":"hyperledger/fabric","slug":"could-not-find-signingidentityfetcher-in-dependenc","errorCode":null,"errorMessage":"could not find SigningIdentityFetcher in dependencies","messagePattern":"could not find SigningIdentityFetcher in dependencies","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/endorsement/builtin/default_endorsement.go","lineNumber":65,"sourceCode":"\tsignature, err := signer.Sign(append(prpBytes, identityBytes...))\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"could not sign the proposal response payload\")\n\t}\n\tendorsement := &peer.Endorsement{Signature: signature, Endorser: identityBytes}\n\treturn endorsement, prpBytes, nil\n}\n\n// Init injects dependencies into the instance of the Plugin\nfunc (e *DefaultEndorsement) Init(dependencies ...endorsement.Dependency) error {\n\tfor _, dep := range dependencies {\n\t\tsIDFetcher, isSigningIdentityFetcher := dep.(identities.SigningIdentityFetcher)\n\t\tif !isSigningIdentityFetcher {\n\t\t\tcontinue\n\t\t}\n\t\te.SigningIdentityFetcher = sIDFetcher\n\t\treturn nil\n\t}\n\treturn errors.New(\"could not find SigningIdentityFetcher in dependencies\")\n}\n","sourceCodeStart":47,"sourceCodeEnd":67,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/endorsement/builtin/default_endorsement.go#L47-L67","documentation":"The default endorsement plugin's Init injects dependencies from a dependency registry; it iterates over them looking for a SigningIdentityFetcher and errors if none is present. The plugin cannot fetch a signing identity for endorsement without this dependency, so initialization aborts.","triggerScenarios":"Calling Init on the builtin DefaultEndorsement when the dependencies slice passed by the plugin/discovery infrastructure contains no element implementing mgmt.SigningIdentityFetcher — a wiring/registration bug in the plugin loader or a custom plugin factory that drops the dependency.","commonSituations":"Custom endorsement plugin registered with a factory that does not append the signing identity fetcher; Fabric version upgrade where the dependency registration API changed; running the plugin outside the peer process (e.g. in tests) without registering the fetcher.","solutions":["Ensure the plugin factory builds the plugin with dependencies that include a SigningIdentityFetcher (via peer's mgmt.GetLocalSignerService / DeserializersManager registration)","Check that the plugin is loaded inside the peer process, where core handlers auto-register the fetcher dependency","Update the custom factory to mirror the builtin DefaultEndorsementFactory's dependency list for the current Fabric version"],"exampleFix":"// before: custom factory omits the fetcher\nfunc (f *MyFactory) New() endorsement.Plugin {\n    return &builtin.DefaultEndorsement{}\n} // Init gets no SigningIdentityFetcher\n// after: register the fetcher alongside the plugin\nplugin := &builtin.DefaultEndorsement{}\nplugin.Init([]interface{}{mgmt.GetLocalSigningIdentityOrPanic()}) // implements SigningIdentityFetcher\nreturn plugin","handlingStrategy":"validation","validationCode":"deps := []interface{}{mgmt.GetLocalSignerService()}\nhasFetcher := false\nfor _, d := range deps {\n    if _, ok := d.(mgmt.SigningIdentityFetcher); ok { hasFetcher = true }\n}\nif !hasFetcher { return errors.New(\"SigningIdentityFetcher must be registered before Init\") }\nreturn plugin.Init(deps)","typeGuard":"func hasIdentityFetcher(deps []interface{}) bool {\n    for _, d := range deps {\n        if _, ok := d.(mgmt.SigningIdentityFetcher); ok { return true }\n    }\n    return false\n}","tryCatchPattern":"if err := plugin.Init(deps); err != nil {\n    return fmt.Errorf(\"plugin init failed: %w\", err)\n}","preventionTips":["Always construct plugins via their factories so the peer registers all dependencies","When upgrading Fabric, re-check the dependency registration API","In tests, inject a mock SigningIdentityFetcher explicitly","Assert Init succeeds before any Endorse call"],"tags":["fabric","endorsement-plugin","dependency-injection","plugin-init","wiring"],"backgroundTag":"missing-dependency-injection","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"}