{"record":{"id":"b9eacb95e202ee16","repo":"hyperledger/fabric","slug":"service-message-type-not-valid","errorCode":null,"errorMessage":"service message type not valid","messagePattern":"service message type not valid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/cluster/commauth.go","lineNumber":324,"sourceCode":"\t\t\t\tNodeConrequest: &orderer.NodeConsensusRequest{\n\t\t\t\t\tPayload:  consReq.Payload,\n\t\t\t\t\tMetadata: consReq.Metadata,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\treturn stepRequest, nil\n\t} else if subReq := request.GetSubmitRequest(); subReq != nil {\n\t\tstepRequest = &orderer.ClusterNodeServiceStepRequest{\n\t\t\tPayload: &orderer.ClusterNodeServiceStepRequest_NodeTranrequest{\n\t\t\t\tNodeTranrequest: &orderer.NodeTransactionOrderRequest{\n\t\t\t\t\tPayload:           subReq.Payload,\n\t\t\t\t\tLastValidationSeq: subReq.LastValidationSeq,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\treturn stepRequest, nil\n\t}\n\treturn nil, errors.New(\"service message type not valid\")\n}\n\nfunc BuildStepRespone(stepResponse *orderer.ClusterNodeServiceStepResponse) (*orderer.StepResponse, error) {\n\tif stepResponse == nil {\n\t\treturn nil, errors.New(\"input response object is nil\")\n\t}\n\tif respPayload := stepResponse.GetTranorderRes(); respPayload != nil {\n\t\tstepResponse := &orderer.StepResponse{\n\t\t\tPayload: &orderer.StepResponse_SubmitRes{\n\t\t\t\tSubmitRes: &orderer.SubmitResponse{\n\t\t\t\t\tChannel: respPayload.Channel,\n\t\t\t\t\tStatus:  respPayload.Status,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\treturn stepResponse, nil\n\t}\n\treturn nil, errors.New(\"service stream returned with invalid response type\")","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/cluster/commauth.go#L306-L342","documentation":"BuildStepRequest only supports StepRequests whose oneof payload is either a ConsensusRequest or a SubmitRequest. If neither GetConsensusRequest() nor GetSubmitRequest() yields a non-nil message, it returns 'service message type not valid' — the StepRequest carried no recognized payload for the node cluster service.","triggerScenarios":"Calling Send() with a &orderer.StepRequest{} that has its Payload oneof unset, or set to a payload variant this mapper does not handle (e.g. a newer/other message type added to the proto).","commonSituations":"Constructing StepRequest literals without setting the Payload oneof field; proto version drift where a new request type was added but this mapper was not updated; unmarshaling errors leaving Payload empty.","solutions":["Ensure every StepRequest you send has either Payload set to &orderer.StepRequest_ConsensusRequest{...} or &orderer.StepRequest_SubmitRequest{...}.","Check proto/generated-code versions on both sides are in sync; update this mapper if a new payload type was introduced.","At the call site, verify the request's GetPayload() is non-nil before calling Send."],"exampleFix":"// before\nreq := &orderer.StepRequest{} // payload unset\nerr := stream.Send(req) // \"service message type not valid\"\n// after\nreq := &orderer.StepRequest{\n    Payload: &orderer.StepRequest_ConsensusRequest{\n        ConsensusRequest: &orderer.ConsensusRequest{\n            Payload:    payloadBytes,\n            Metadata:   metaBytes,\n        },\n    },\n}\nerr := stream.Send(req)","handlingStrategy":"type-guard","validationCode":"switch req.GetPayload().(type) {\ncase *orderer.StepRequest_ConsensusRequest, *orderer.StepRequest_SubmitRequest:\n    // ok\ndefault:\n    return errors.New(\"StepRequest payload must be consensus or submit\")\n}\nerr := stream.Send(req)","typeGuard":"func isSupportedPayload(r *orderer.StepRequest) bool {\n    return r.GetConsensusRequest() != nil || r.GetSubmitRequest() != nil\n}","tryCatchPattern":"if err := stream.Send(req); err != nil {\n    if err.Error() == \"service message type not valid\" {\n        log.Errorf(\"unrecognized StepRequest payload: %T\", req.GetPayload())\n    }\n    return err\n}","preventionTips":["Always set the Payload oneof when constructing StepRequest literals.","Keep generated protobuf code and this mapper in sync across version upgrades.","Test round-tripping every supported payload type through BuildStepRequest."],"tags":["fabric","protobuf","oneof","request-validation"],"backgroundTag":"unsupported-message-type","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"}