{"record":{"id":"217ed0decabde546","repo":"hyperledger/fabric","slug":"failed-initializing-plugin","errorCode":null,"errorMessage":"failed initializing plugin","messagePattern":"failed initializing plugin","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/committer/txvalidator/v14/plugin_validator.go","lineNumber":184,"sourceCode":"\tplugin, exists = pbc.channels2Plugins[channel]\n\tif exists {\n\t\treturn plugin, nil\n\t}\n\n\tpluginInstance := pbc.pluginFactory.New()\n\tplugin, err := pbc.initPlugin(pluginInstance, channel)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbc.channels2Plugins[channel] = plugin\n\treturn plugin, nil\n}\n\nfunc (pbc *pluginsByChannel) initPlugin(plugin validation.Plugin, channel string) (validation.Plugin, error) {\n\tpe := &PolicyEvaluator{IdentityDeserializer: pbc.pv.IdentityDeserializer}\n\tsf := &StateFetcherImpl{QueryExecutorCreator: pbc.pv}\n\tif err := plugin.Init(pe, sf, pbc.pv.capabilities, &legacyCollectionInfoProvider{}); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed initializing plugin\")\n\t}\n\treturn plugin, nil\n}\n\n// legacyCollectionInfoProvider implements a provider for collection\n// information for the legacy lifecycle. It will never be called but\n// it is necessary to have this dependency passed at init time to the\n// default plugin\ntype legacyCollectionInfoProvider struct{}\n\nfunc (*legacyCollectionInfoProvider) CollectionValidationInfo(chaincodeName, collectionName string, state vs.State) ([]byte, error, error) {\n\tpanic(\"programming error\")\n}\n\ntype PolicyEvaluator struct {\n\tmsp.IdentityDeserializer\n}\n","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/committer/txvalidator/v14/plugin_validator.go#L166-L202","documentation":"A validation plugin was found and instantiated, but its Init() call failed when given the policy evaluator, state fetcher, capabilities, and collection-info provider. The underlying plugin error is wrapped with this message and validation aborts.","triggerScenarios":"plugin.Init(pe, sf, capabilities, collectionInfoProvider) returns an error during createPluginIfAbsent, e.g., the plugin rejects the provided dependencies or fails internal initialization.","commonSituations":"Custom VSCC plugin that requires state it cannot fetch or mismatches the Fabric plugin API version; plugin compiled against a different validation.Plugin interface (Fabric version mismatch); plugin panics/errors on capabilities it doesn't support.","solutions":["Check peer logs for the wrapped inner error from plugin.Init","Rebuild the plugin against the exact Fabric version of the peer","Verify the plugin's Init implementation handles the provided PolicyEvaluator/StateFetcher correctly","Remove or correct the plugin in core.yaml handlers and fall back to the default vscc"],"exampleFix":"// before: plugin built against Fabric 1.4 API used on 2.x peer\n// after\ngo mod edit -require github.com/hyperledger/fabric@v2.5.0 && go build -o myvscc.so","handlingStrategy":"try-catch","validationCode":"// compile-time check that the plugin implements the current interface\nvar _ validation.Plugin = (*MyPlugin)(nil)\n// and smoke-test Init in a unit test before shipping","typeGuard":"var _ validation.Plugin = (*MyPlugin)(nil)","tryCatchPattern":"plugin, err := pv.getOrCreatePlugin(ctx)\nif err != nil && strings.Contains(err.Error(), \"failed initializing plugin\") {\n    // fall back to default vscc or abort channel validation with clear log\n}","preventionTips":["Test plugin.Init against the exact Fabric release in CI","Keep plugin Go module dependencies in sync with the peer","Handle unsupported capabilities gracefully inside Init","Log the underlying error, not just the wrapper"],"tags":["plugin","validation","initialization"],"backgroundTag":"plugin-initialization-failed","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"}