hyperledger/fabric · error

error during query: received nil proposal response

Error message

error during query: received nil proposal response

What it means

Error in chaincodeInvokeOrQuery's invoke path: after a successful proposal round-trip, the peer returned a proposal response whose Endorsement is nil, meaning the chaincode action could not be endorsed — the peer's Response status/message (printed in the error) explains why (e.g. chaincode execution failure or MVCC conflict).

Source

Thrown at internal/peer/chaincode/common.go:126

	}

	if invoke {
		logger.Debugf("ESCC invoke result: %v", proposalResp)
		pRespPayload, err := protoutil.UnmarshalProposalResponsePayload(proposalResp.Payload)
		if err != nil {
			return errors.WithMessage(err, "error while unmarshalling proposal response payload")
		}
		ca, err := protoutil.UnmarshalChaincodeAction(pRespPayload.Extension)
		if err != nil {
			return errors.WithMessage(err, "error while unmarshalling chaincode action")
		}
		if proposalResp.Endorsement == nil {
			return errors.Errorf("endorsement failure during invoke. response: %v", proposalResp.Response)
		}
		logger.Infof("Chaincode invoke successful. result: %v", ca.Response)
	} else {
		if proposalResp == nil {
			return errors.New("error during query: received nil proposal response")
		}
		if proposalResp.Endorsement == nil {
			return errors.Errorf("endorsement failure during query. response: %v", proposalResp.Response)
		}

		if chaincodeQueryRaw && chaincodeQueryHex {
			return fmt.Errorf("options --raw (-r) and --hex (-x) are not compatible")
		}
		if chaincodeQueryRaw {
			fmt.Println(proposalResp.Response.Payload)
			return nil
		}
		if chaincodeQueryHex {
			fmt.Printf("%x\n", proposalResp.Response.Payload)
			return nil
		}
		fmt.Println(string(proposalResp.Response.Payload))
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Verify the peer is joined to the channel (peer channel list) and reachable
  2. Check TLS settings: --tls, --peerAddresses, --tlsRootCertFiles must be consistent
  3. Retry the query; transient network failures can yield a nil response
  4. Inspect peer container logs for the corresponding proposal RPC error
Defensive patterns

Strategy: retry

Validate before calling

// Confirm peer connectivity and channel membership before querying
peer channel list --peerAddresses $PEER_ADDR --tlsRootCertFiles $TLS_CERT
dig +short $PEER_HOST

Try / catch

for attempt := 0; attempt < 3; attempt++ {
  result, err := query(...)
  if err == nil { return result }
  if strings.Contains(err.Error(), "received nil proposal response") {
    time.Sleep(backoff(attempt)); continue
  }
  return err
}
return errors.New("query failed after retries")

Prevention

When it happens

Trigger: peer chaincode query where the endorser processing returned nil proposalResp (no endorser responded successfully to the query proposal).

Common situations: All targeted endorsers unreachable or returning transport errors that collapse to a nil response; misconfigured peer addresses; query against a peer that has not joined the channel.

Related errors


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