hyperledger/fabric · error
nil instantiation policy
Error message
nil instantiation policy
What it means
Returned by createSignedCCDepSpec when the instantiation-policy bytes argument is nil while assembling a signed chaincode deployment envelope. A package must carry an instantiation policy even when defaults are intended; nil means the caller omitted it.
Source
Thrown at core/common/ccpackage/ccpackage.go:86
if !bytes.Equal(baseCip.ChaincodeDeploymentSpec, otherCip.ChaincodeDeploymentSpec) {
return fmt.Errorf("Rule-all deployment specs should match(%d, %d)", len(baseCip.ChaincodeDeploymentSpec), len(otherCip.ChaincodeDeploymentSpec))
}
if !bytes.Equal(baseCip.InstantiationPolicy, otherCip.InstantiationPolicy) {
return fmt.Errorf("Rule-all instantiation policies should match(%d, %d)", len(baseCip.InstantiationPolicy), len(otherCip.InstantiationPolicy))
}
return nil
}
func createSignedCCDepSpec(cdsbytes []byte, instpolicybytes []byte, endorsements []*peer.Endorsement) (*common.Envelope, error) {
if cdsbytes == nil {
return nil, errors.New("nil chaincode deployment spec")
}
if instpolicybytes == nil {
return nil, errors.New("nil instantiation policy")
}
// create SignedChaincodeDeploymentSpec...
cip := &peer.SignedChaincodeDeploymentSpec{ChaincodeDeploymentSpec: cdsbytes, InstantiationPolicy: instpolicybytes, OwnerEndorsements: endorsements}
// ...and marshal it
cipbytes := protoutil.MarshalOrPanic(cip)
// use defaults (this is definitely ok for install package)
msgVersion := int32(0)
epoch := uint64(0)
chdr := protoutil.MakeChannelHeader(common.HeaderType_CHAINCODE_PACKAGE, msgVersion, "", epoch)
// create the payload
payl := &common.Payload{Header: &common.Header{ChannelHeader: protoutil.MarshalOrPanic(chdr)}, Data: cipbytes}
paylBytes, err := protoutil.GetBytesPayload(payl)
if err != nil {
return nil, errView on GitHub (pinned to 2736b63f8f)
Solutions
- Supply a valid serialized instantiation policy (e.g. from the channel's instantiation policy or a principal set)
- Guard upstream callers against passing nil instpolicybytes
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/common/ccpackage/ccpackage.go:86 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/eb4a1408919b4dd3.
Report an issue: GitHub.