{"record":{"id":"eb4a1408919b4dd3","repo":"hyperledger/fabric","slug":"nil-instantiation-policy","errorCode":null,"errorMessage":"nil instantiation policy","messagePattern":"nil instantiation policy","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/common/ccpackage/ccpackage.go","lineNumber":86,"sourceCode":"\n\tif !bytes.Equal(baseCip.ChaincodeDeploymentSpec, otherCip.ChaincodeDeploymentSpec) {\n\t\treturn fmt.Errorf(\"Rule-all deployment specs should match(%d, %d)\", len(baseCip.ChaincodeDeploymentSpec), len(otherCip.ChaincodeDeploymentSpec))\n\t}\n\n\tif !bytes.Equal(baseCip.InstantiationPolicy, otherCip.InstantiationPolicy) {\n\t\treturn fmt.Errorf(\"Rule-all instantiation policies should match(%d, %d)\", len(baseCip.InstantiationPolicy), len(otherCip.InstantiationPolicy))\n\t}\n\n\treturn nil\n}\n\nfunc createSignedCCDepSpec(cdsbytes []byte, instpolicybytes []byte, endorsements []*peer.Endorsement) (*common.Envelope, error) {\n\tif cdsbytes == nil {\n\t\treturn nil, errors.New(\"nil chaincode deployment spec\")\n\t}\n\n\tif instpolicybytes == nil {\n\t\treturn nil, errors.New(\"nil instantiation policy\")\n\t}\n\n\t// create SignedChaincodeDeploymentSpec...\n\tcip := &peer.SignedChaincodeDeploymentSpec{ChaincodeDeploymentSpec: cdsbytes, InstantiationPolicy: instpolicybytes, OwnerEndorsements: endorsements}\n\n\t// ...and marshal it\n\tcipbytes := protoutil.MarshalOrPanic(cip)\n\n\t// use defaults (this is definitely ok for install package)\n\tmsgVersion := int32(0)\n\tepoch := uint64(0)\n\tchdr := protoutil.MakeChannelHeader(common.HeaderType_CHAINCODE_PACKAGE, msgVersion, \"\", epoch)\n\n\t// create the payload\n\tpayl := &common.Payload{Header: &common.Header{ChannelHeader: protoutil.MarshalOrPanic(chdr)}, Data: cipbytes}\n\tpaylBytes, err := protoutil.GetBytesPayload(payl)\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/common/ccpackage/ccpackage.go#L68-L104","documentation":"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.","triggerScenarios":"Thrown at core/common/ccpackage/ccpackage.go:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}