hyperledger/fabric · error
input response object is nil
Error message
input response object is nil
What it means
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.
Source
Thrown at orderer/common/cluster/commauth.go:329
}
return stepRequest, nil
} else if subReq := request.GetSubmitRequest(); subReq != nil {
stepRequest = &orderer.ClusterNodeServiceStepRequest{
Payload: &orderer.ClusterNodeServiceStepRequest_NodeTranrequest{
NodeTranrequest: &orderer.NodeTransactionOrderRequest{
Payload: subReq.Payload,
LastValidationSeq: subReq.LastValidationSeq,
},
},
}
return stepRequest, nil
}
return nil, errors.New("service message type not valid")
}
func BuildStepRespone(stepResponse *orderer.ClusterNodeServiceStepResponse) (*orderer.StepResponse, error) {
if stepResponse == nil {
return nil, errors.New("input response object is nil")
}
if respPayload := stepResponse.GetTranorderRes(); respPayload != nil {
stepResponse := &orderer.StepResponse{
Payload: &orderer.StepResponse_SubmitRes{
SubmitRes: &orderer.SubmitResponse{
Channel: respPayload.Channel,
Status: respPayload.Status,
},
},
}
return stepResponse, nil
}
return nil, errors.New("service stream returned with invalid response type")
}
View on GitHub (pinned to 2736b63f8f)
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
Example fix
// before
resp, _ := BuildStepRespone(someResp)
// after
if someResp == nil {
return nil, errors.New("no step response received from node")
}
resp, err := BuildStepRespone(someResp) Defensive patterns
Strategy: validation
Validate before calling
if stepResponse == nil {
return nil, fmt.Errorf("no step response received")
}
resp, err := BuildStepRespone(stepResponse) Type guard
func hasStepResponse(r *orderer.ClusterNodeServiceStepResponse) bool {
return r != nil && r.GetTranorderRes() != nil
} Try / catch
resp, err := BuildStepRespone(stepResponse)
if err != nil {
log.Warnf("step response conversion failed: %v", err)
return err
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- invalid request object
- service stream returned with invalid response type
- chaincode interest is nil
- got unexpected status: %v -- %s
- session binding read failed
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/e41c44ef07f68751.
Report an issue: GitHub.