{"record":{"id":"e41c44ef07f68751","repo":"hyperledger/fabric","slug":"input-response-object-is-nil","errorCode":null,"errorMessage":"input response object is nil","messagePattern":"input response object is nil","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/cluster/commauth.go","lineNumber":329,"sourceCode":"\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\")\n}\n","sourceCodeStart":311,"sourceCodeEnd":344,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/cluster/commauth.go#L311-L344","documentation":"BuildStepRespone converts an orderer ClusterNodeServiceStepResponse into an orderer.StepResponse. This error is thrown when the input pointer is nil, i.e. the caller passed no response object to convert. It is a defensive nil-check at the top of the public API.","triggerScenarios":"Calling BuildStepRespone(nil) directly, or Recv receiving an anonymous/grpc wrapper whose underlying response message is a nil typed pointer (e.g. a nil *ClusterNodeServiceStepResponse produced by a failed Unmarshal or empty stream message).","commonSituations":"A remote cluster node closed the stream or sent an empty payload; a failed proto unmarshal left the response pointer nil; unit tests invoking the converter without constructing a response.","solutions":["Check the response for nil before calling BuildStepRespone","In Recv, skip/ignore nil response messages returned from the stream before conversion","If the nil comes from unmarshalling, verify the payload bytes are valid protobuf for ClusterNodeServiceStepResponse"],"exampleFix":"// before\nresp, _ := BuildStepRespone(someResp)\n// after\nif someResp == nil {\n    return nil, errors.New(\"no step response received from node\")\n}\nresp, err := BuildStepRespone(someResp)","handlingStrategy":"validation","validationCode":"if stepResponse == nil {\n    return nil, fmt.Errorf(\"no step response received\")\n}\nresp, err := BuildStepRespone(stepResponse)","typeGuard":"func hasStepResponse(r *orderer.ClusterNodeServiceStepResponse) bool {\n    return r != nil && r.GetTranorderRes() != nil\n}","tryCatchPattern":"resp, err := BuildStepRespone(stepResponse)\nif err != nil {\n    log.Warnf(\"step response conversion failed: %v\", err)\n    return err\n}","preventionTips":["Always nil-check grpc response messages after Recv/unmarshal before use","Return early on nil rather than dereferencing typed nil pointers","Test Recv paths with empty/nil stream messages"],"tags":["grpc","nil-pointer","orderer","cluster"],"backgroundTag":"nil-pointer-input","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"}