{"record":{"id":"9e55232d25263810","repo":"hyperledger/fabric","slug":"proto-marshal-called-with-nil-9e5523","errorCode":null,"errorMessage":"proto: Marshal called with nil","messagePattern":"proto: Marshal called with nil","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoutil/txutils.go","lineNumber":395,"sourceCode":"// passed arguments\nfunc MockSignedEndorserProposalOrPanic(\n\tchannelID string,\n\tcs *peer.ChaincodeSpec,\n\tcreator,\n\tsignature []byte,\n) (*peer.SignedProposal, *peer.Proposal) {\n\tprop, _, err := CreateChaincodeProposal(\n\t\tcommon.HeaderType_ENDORSER_TRANSACTION,\n\t\tchannelID,\n\t\t&peer.ChaincodeInvocationSpec{ChaincodeSpec: cs},\n\t\tcreator,\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif prop == nil {\n\t\tpanic(errors.New(\"proto: Marshal called with nil\"))\n\t}\n\tpropBytes, err := proto.Marshal(prop)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &peer.SignedProposal{ProposalBytes: propBytes, Signature: signature}, prop\n}\n\nfunc MockSignedEndorserProposal2OrPanic(\n\tchannelID string,\n\tcs *peer.ChaincodeSpec,\n\tsigner Signer,\n) (*peer.SignedProposal, *peer.Proposal) {\n\tserializedSigner, err := signer.Serialize()\n\tif err != nil {\n\t\tpanic(err)\n\t}","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/protoutil/txutils.go#L377-L413","documentation":"MockSignedEndorserProposalOrPanic test helper panic: CreateChaincodeProposal returned a nil proposal without an error, so marshalling it would panic in proto.Marshal. The helper converts this impossible-but-detected condition into an explicit panic with the sentinel text 'proto: Marshal called with nil'.","triggerScenarios":"Thrown at protoutil/txutils.go:395 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix CreateChaincodeProposal to never return (nil, nil)","Adjust the test inputs (channel/chaincode spec) so proposal creation succeeds"],"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"}