{"record":{"id":"3587db13d3f267f0","repo":"hyperledger/fabric","slug":"failed-initializing-plugin-3587db","errorCode":null,"errorMessage":"failed initializing plugin","messagePattern":"failed initializing plugin","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/committer/txvalidator/v20/plugindispatcher/plugin_validator.go","lineNumber":208,"sourceCode":"\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\tpp, err := policy.New(pbc.pv.IdentityDeserializer, channel, pbc.pv.ChannelPolicyManagerGetter)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not obtain a policy evaluator\")\n\t}\n\n\tpe := &PolicyEvaluatorWrapper{IdentityDeserializer: pbc.pv.IdentityDeserializer, PolicyEvaluator: pp}\n\tsf := &StateFetcherImpl{QueryExecutorCreator: pbc.pv}\n\tif err := plugin.Init(pe, sf, pbc.pv.capabilities, pbc.pv.CollectionResources); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed initializing plugin\")\n\t}\n\treturn plugin, nil\n}\n\ntype PolicyEvaluatorWrapper struct {\n\tmsp.IdentityDeserializer\n\tvp.PolicyEvaluator\n}\n\n// Evaluate takes a set of SignedData and evaluates whether this set of signatures satisfies the policy\nfunc (id *PolicyEvaluatorWrapper) Evaluate(policyBytes []byte, signatureSet []*protoutil.SignedData) error {\n\treturn id.PolicyEvaluator.Evaluate(policyBytes, signatureSet)\n}\n\n// DeserializeIdentity unmarshals the given identity to msp.Identity\nfunc (id *PolicyEvaluatorWrapper) DeserializeIdentity(serializedIdentity []byte) (vi.Identity, error) {\n\tmspIdentity, err := id.IdentityDeserializer.DeserializeIdentity(serializedIdentity)\n\tif err != nil {","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/committer/txvalidator/v20/plugindispatcher/plugin_validator.go#L190-L226","documentation":"initPlugin created a validation plugin instance and called plugin.Init(policyEvaluator, stateFetcher, capabilities, collectionResources); Init returned an error, so Fabric wraps it as 'failed initializing plugin'. This means the plugin itself rejected its initialization (bad policy bytes it could not evaluate, state access failure, or internal plugin error).","triggerScenarios":"First validation of a tx for a chaincode whose plugin instance fails Init — e.g. vscc cannot build an evaluator from the stored endorsement-policy bytes (corrupt/unsupported policy), or a custom plugin's Init errors on its own config/capability checks.","commonSituations":"Corrupt endorsement-policy bytes in the chaincode definition; plugin requiring a capability the peer/channel does not have (mismatched channel capabilities vs plugin expectations); bugs in custom vscc Init implementations; channel resources (CollectionResources) not available for private-data-aware plugins.","solutions":["Read the wrapped cause (errors.Wrap output) in the peer log to find why plugin.Init failed and fix that root cause.","Re-issue the chaincode definition with a valid, well-formed endorsement policy.","Upgrade the peer to a version whose capabilities match the plugin's requirements.","Fix or rebuild the custom validation plugin's Init implementation and redeploy it to all validating peers.","Retry after repairing state/channel resources if the cause was transient state-fetch failure."],"exampleFix":"// before (custom plugin)\nfunc (p *MyPlugin) Init(...) error { return fmt.Errorf(\"unsupported policy type\") }\n// after\nfunc (p *MyPlugin) Init(pe, sf, caps, colRes) error { /* evaluate policy bytes correctly */ return nil }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { validate(tx); } catch (err) { if (/failed initializing plugin/.test(err.message)) { const cause = err.cause ?? err; log.error('plugin init failed:', cause.message); /* fix policy/capability/plugin per cause */ } else { throw err; } }","preventionTips":["Ensure endorsement-policy bytes are well-formed (test with common/tools/protolator or policy parser).","Match channel capabilities to plugin requirements.","Keep chaincode definition policies supported by the peer's plugin.","Unit-test custom plugin Init before channel deployment."],"tags":["hyperledger-fabric","validation-plugin","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"}