hyperledger/fabric · error

Cannot read channels list response, %s

Error message

Cannot read channels list response, %s

What it means

This error is returned by getChannels when the payload of an approved proposal response cannot be unmarshaled into a pb.ChannelQueryResponse protobuf message. It means the orderer/peer returned a successful status, but the response bytes are not a valid encoded channels-list structure. This typically indicates the endpoint is not the service expected or a protobuf/runtime incompatibility.

Source

Thrown at internal/peer/channel/list.go:79

	var signedProp *pb.SignedProposal
	signedProp, err = protoutil.GetSignedProposal(prop, cc.cf.Signer)
	if err != nil {
		return nil, fmt.Errorf("Cannot create signed proposal, due to %s", err)
	}

	proposalResp, err := cc.cf.EndorserClient.ProcessProposal(context.Background(), signedProp)
	if err != nil {
		return nil, fmt.Errorf("Failed sending proposal, got %s", err)
	}

	if proposalResp.Response == nil || proposalResp.Response.Status != http.StatusOK {
		return nil, fmt.Errorf("Received bad response, status %d: %s", proposalResp.Response.Status, proposalResp.Response.Message)
	}

	var channelQueryResponse pb.ChannelQueryResponse
	err = proto.Unmarshal(proposalResp.Response.Payload, &channelQueryResponse)
	if err != nil {
		return nil, fmt.Errorf("Cannot read channels list response, %s", err)
	}

	return channelQueryResponse.Channels, nil
}

func list(cf *ChannelCmdFactory) error {
	var err error
	if cf == nil {
		cf, err = InitCmdFactory(EndorserRequired, PeerDeliverNotRequired, OrdererNotRequired)
		if err != nil {
			return err
		}
	}

	client := &endorserClient{cf}

	if channels, err := client.getChannels(); err != nil {
		return err

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Verify the peer address/port in --peerAddress (or CORE_PEER_ADDRESS) points to a real fabric peer, not an orderer or another service
  2. Align the fabric-protos-go / fabric-cli versions with the network's Fabric release
  3. Enable debug logging and inspect the raw proposal response payload to confirm what the server actually returned
  4. Retry against a different peer in the organization to rule out a misbehaving single node

Example fix

// before
peerClient, err := channel.NewDeliverClient(...) // wrong target: orderer endpoint
chans, err := getChannels(cf) // Cannot read channels list response
// after
// set correct peer endpoint
os.Setenv("CORE_PEER_ADDRESS", "peer0.org1.example.com:7051")
chans, err := getChannels(cf)
Defensive patterns

Strategy: validation

Validate before calling

// Before calling list, verify the peer endpoint responds to the query service
resp, err := proposalResp(ctx, peer)
if err != nil { return err }
if len(resp.Response.Payload) == 0 {
    return fmt.Errorf("empty payload from peer %s; not a channels query endpoint", peerURL)
}
var cqr pb.ChannelQueryResponse
if err := proto.Unmarshal(resp.Response.Payload, &cqr); err != nil {
    return fmt.Errorf("peer %s returned non-protobuf payload; check endpoint/versions", peerURL)
}

Type guard

func isValidChannelQueryResponse(payload []byte) bool {
    var cqr pb.ChannelQueryResponse
    return proto.Unmarshal(payload, &cqr) == nil
}

Prevention

When it happens

Trigger: Calling the peer channel list command when the proposal response payload contains malformed, empty, or non-ChannelQueryResponse protobuf bytes — e.g. the targeted node is not actually serving the channels query service, or the fabric-protos library version differs from the server's.

Common situations: Pointing the CLI at an orderer or wrong peer port instead of the peer's channel query endpoint; running a newer/older fabric CLI against an older network (protobuf schema drift); a proxy returning an HTML/JSON error body inside a 200 response.

Understand the failure class

Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.

Related errors


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