{"record":{"id":"b5a8e678b6aefec5","repo":"hyperledger/fabric","slug":"error-marshaling-proposalresponsepayload","errorCode":null,"errorMessage":"error marshaling ProposalResponsePayload","messagePattern":"error marshaling ProposalResponsePayload","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoutil/proputils.go","lineNumber":131,"sourceCode":"\n// GetBytesProposalResponsePayload gets proposal response payload\nfunc GetBytesProposalResponsePayload(hash []byte, response *peer.Response, result []byte, event []byte, ccid *peer.ChaincodeID) ([]byte, error) {\n\tcAct := &peer.ChaincodeAction{\n\t\tEvents: event, Results: result,\n\t\tResponse:    response,\n\t\tChaincodeId: ccid,\n\t}\n\tcActBytes, err := proto.Marshal(cAct)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error marshaling ChaincodeAction\")\n\t}\n\n\tprp := &peer.ProposalResponsePayload{\n\t\tExtension:    cActBytes,\n\t\tProposalHash: hash,\n\t}\n\tprpBytes, err := proto.Marshal(prp)\n\treturn prpBytes, errors.Wrap(err, \"error marshaling ProposalResponsePayload\")\n}\n\n// GetBytesChaincodeProposalPayload gets the chaincode proposal payload\nfunc GetBytesChaincodeProposalPayload(cpp *peer.ChaincodeProposalPayload) ([]byte, error) {\n\tif cpp == nil {\n\t\treturn nil, errors.New(\"error marshaling ChaincodeProposalPayload: proto: Marshal called with nil\")\n\t}\n\tcppBytes, err := proto.Marshal(cpp)\n\treturn cppBytes, errors.Wrap(err, \"error marshaling ChaincodeProposalPayload\")\n}\n\n// GetBytesResponse gets the bytes of Response\nfunc GetBytesResponse(res *peer.Response) ([]byte, error) {\n\tif res == nil {\n\t\treturn nil, errors.New(\"error marshaling Response: proto: Marshal called with nil\")\n\t}\n\tresBytes, err := proto.Marshal(res)\n\treturn resBytes, errors.Wrap(err, \"error marshaling Response\")","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/protoutil/proputils.go#L113-L149","documentation":"After marshaling the ChaincodeAction, GetBytesProposalResponsePayload marshals the enclosing ProposalResponsePayload (extension bytes + proposal hash) and wraps any failure with this message. Like the sibling errors, a real failure indicates a protobuf descriptor/library mismatch rather than business data.","triggerScenarios":"CreateProposalResponse / CreateProposalResponseFailure / TestProposalResponse / ProcessProposalSuccessfullyOrError invoking GetBytesProposalResponsePayload with a hash and previously marshaled extension bytes, where proto.Marshal of the 2-field ProposalResponsePayload fails — practically only from proto incompatibility or corrupted binary.","commonSituations":"Divergent fabric-protos-go in plugins/external builders; corrupted installs; exotic platforms where the proto registry fails to init.","solutions":["Pin a single fabric-protos-go version and rebuild (`go mod tidy && go build`)","Verify ProposalHash is a normal []byte (any content is marshalable; so inspect proto init)","Rebuild with `go clean -cache` to clear stale descriptors"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"prp := &peer.ProposalResponsePayload{Extension: cActBytes, ProposalHash: hash}\nif _, err := proto.Marshal(prp); err != nil {\n\treturn fmt.Errorf(\"ProposalResponsePayload not marshalable: %w\", err)\n}","typeGuard":"func prpMarshalable(prp *peer.ProposalResponsePayload) bool {\n\tif prp == nil { return false }\n\t_, err := proto.Marshal(prp)\n\treturn err == nil\n}","tryCatchPattern":"prpBytes, err := protoutil.GetBytesProposalResponsePayload(hash, result, event, response, ccid)\nif err != nil {\n\tlog.Errorf(\"proposal response payload marshal failed (proto runtime mismatch?): %v\", err)\n\treturn err\n}","preventionTips":["Align protobuf-go runtime versions; run go mod tidy on upgrades","Rebuild with go clean -cache after proto dependency changes","Smoke-test full endorsement flow in CI on every proto upgrade"],"tags":["fabric","protobuf","marshal","proposal-response"],"backgroundTag":"protobuf-marshal-failed","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"}