hyperledger/fabric · error

identityDeserializer not passed in init

Error message

identityDeserializer not passed in init

What it means

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.

Source

Thrown at core/handlers/validation/builtin/default_validation.go:131

		}
		if capabilities, isCapabilities := dep.(vc.Capabilities); isCapabilities {
			c = capabilities
		}
		if stateFetcher, isStateFetcher := dep.(vs.StateFetcher); isStateFetcher {
			sf = stateFetcher
		}
		if policyEvaluator, isPolicyFetcher := dep.(vp.PolicyEvaluator); isPolicyFetcher {
			pe = policyEvaluator
		}
		if collectionResources, isCollectionResources := dep.(plugindispatcher.CollectionResources); isCollectionResources {
			cor = collectionResources
		}
	}
	if sf == nil {
		return errors.New("stateFetcher not passed in init")
	}
	if d == nil {
		return errors.New("identityDeserializer not passed in init")
	}
	if c == nil {
		return errors.New("capabilities not passed in init")
	}
	if pe == nil {
		return errors.New("policy fetcher not passed in init")
	}
	if cor == nil {
		return errors.New("collection resources not passed in init")
	}

	v.Capabilities = c
	v.TxValidatorV1_2 = v12.New(c, sf, d, pe)
	v.TxValidatorV1_3 = v13.New(c, sf, d, pe)
	v.TxValidatorV2_0 = v20.New(c, sf, d, pe, cor)

	return nil
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Provide a valid IdentityDeserializer (e.g. mspmgmt-based deserializer) in the dependencies passed to Init()
  2. Verify the wiring/factory code sets every required dependency: sf, d, c, pe, cor
  3. Fix any unit test fixtures to include a deserializer (a stub is acceptable)

Example fix

// before
err := handler.Init(sf, nil, capabilities, policyEvaluator, collectionResources)
// after
d := &identity.MSPIdentityDeserializer{}
err := handler.Init(sf, d, capabilities, policyEvaluator, collectionResources)
Defensive patterns

Strategy: validation

Validate before calling

if d == nil {
    return errors.New("cannot init validation handler: IdentityDeserializer dependency is nil")
}
err := handler.Init(sf, d, c, pe, cor)

Type guard

func depsComplete(d IdentityDeserializer) bool { return d != nil }

Prevention

When it happens

Trigger: Calling Init() with d == nil: constructing the built-in validation handler without an IdentityDeserializer in the dependency set.

Common situations: Custom plugin wiring that supplies the state fetcher but forgets the identity deserializer; misordered DI initialization; mocked dependencies in tests missing one field.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/b57b9c96ca6f8b53. Report an issue: GitHub.