{"record":{"id":"1a32c5cd306a1b37","repo":"hyperledger/fabric","slug":"capabilities-not-passed-in-init","errorCode":null,"errorMessage":"capabilities not passed in init","messagePattern":"capabilities not passed in init","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/default_validation.go","lineNumber":134,"sourceCode":"\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}\n","sourceCodeStart":116,"sourceCodeEnd":150,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/default_validation.go#L116-L150","documentation":"Init() returns this error when the capabilities dependency is nil. The validator consults the channel capabilities (e.g. whether collection config upgrades, key-level validation, or v1.2+ features are enabled) to decide which validation paths to apply. Without capabilities it cannot validate safely and refuses to start.","triggerScenarios":"Calling Init() with c == nil: constructing the built-in validation handler without a Capabilities provider in the dependency map.","commonSituations":"Hand-rolled plugin constructors omitting channel capabilities; peers created before capabilities were wired in newer versions; test harnesses with incomplete dependency stubs.","solutions":["Supply the channel Capabilities object (typically from the channelconfig/capabilities provider) to Init()","Check that dependency assembly for validation handlers includes all five required deps (sf, d, c, pe, cor)","Update custom plugin code after version upgrades so new required dependencies are provided"],"exampleFix":"// before\nerr := handler.Init(sf, deserializer, nil, policyEvaluator, collectionResources)\n// after\ncaps := channelconfig.NewApplicationCapabilities(...)\nerr := handler.Init(sf, deserializer, caps, policyEvaluator, collectionResources)","handlingStrategy":"validation","validationCode":"if c == nil {\n    return errors.New(\"cannot init validation handler: Capabilities dependency is nil\")\n}\nerr := handler.Init(sf, d, c, pe, cor)","typeGuard":"func depsComplete(c Capabilities) bool { return c != nil }","tryCatchPattern":null,"preventionTips":["Fetch channel capabilities from the channel config before creating validators","Update custom plugins when new versions add required dependencies","Verify Init is called only after channelconfig is loaded"],"tags":["go","initialization","dependency-injection","capabilities"],"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"}