hyperledger/fabric · error

service stream returned with invalid response type

Error message

service stream returned with invalid response type

What it means

BuildStepRespone only knows how to map a response whose payload is TranorderRes. If the ClusterNodeServiceStepResponse carries none of the recognized payload types, the conversion is impossible and this error is returned.

Solutions

  1. Ensure all cluster nodes run a compatible fabric version so responses use the TranorderRes payload
  2. Log/inspect the raw response type to identify which variant was returned
  3. Return a typed error upstream so Recv can retry against a different node
Defensive patterns

Strategy: try-catch

Validate before calling

if stepResponse != nil && stepResponse.GetTranorderRes() == nil {
    return fmt.Errorf("unsupported step response payload type")
}

Type guard

func isTranorderRes(r *orderer.ClusterNodeServiceStepResponse) bool {
    return r != nil && r.GetTranorderRes() != nil
}

Try / catch

resp, err := BuildStepRespone(stepResponse)
if err != nil {
    return fmt.Errorf("cannot convert node response: %w", err)
}

Prevention

When it happens

Trigger: Calling BuildStepRespone with a response whose GetTranorderRes() returns nil — e.g. the peer sent a status-only or unrecognized response variant on the cluster Step stream.

Common situations: Mixed-version fabric nodes where the remote orderer responds with a payload type this node doesn't understand; a misrouted request hitting a node that answers with a non-TranorderRes message.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/67e20ed09830524f. Report an issue: GitHub.

Appendix: source

Thrown at orderer/common/cluster/commauth.go:342

	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)