hyperledger/fabric · error

received nil proposal response

Error message

received nil proposal response

What it means

Commit picks responses[0] as the representative proposal response and checks it before creating the signed transaction. If that first element is a nil pointer, the code throws this error to avoid a nil dereference.

Source

Thrown at internal/peer/lifecycle/chaincode/commit.go:192

	for _, endorser := range c.EndorserClients {
		proposalResponse, err := endorser.ProcessProposal(context.Background(), signedProposal)
		if err != nil {
			return errors.WithMessage(err, "failed to endorse proposal")
		}
		responses = append(responses, proposalResponse)
	}

	if len(responses) == 0 {
		// this should only be empty due to a programming bug
		return errors.New("no proposal responses received")
	}

	// all responses will be checked when the signed transaction is created.
	// for now, just set this so we check the first response's status
	proposalResponse := responses[0]

	if proposalResponse == nil {
		return errors.New("received nil proposal response")
	}

	if proposalResponse.Response == nil {
		return errors.New("received proposal response with nil response")
	}

	if proposalResponse.Response.Status != int32(cb.Status_SUCCESS) {
		return errors.Errorf("proposal failed with status: %d - %s", proposalResponse.Response.Status, proposalResponse.Response.Message)
	}
	// assemble a signed transaction (it's an Envelope message)
	env, err := protoutil.CreateSignedTx(proposal, c.Signer, responses...)
	if err != nil {
		return errors.WithMessage(err, "failed to create signed transaction")
	}

	var dg *chaincode.DeliverGroup
	var ctx context.Context
	if c.Input.WaitForEvent {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Skip nil proposal responses when building the responses slice, or fail early in the caller.
  2. Ensure endorse errors are handled instead of silently appending nil results.
  3. Validate each endorser client's response before Commit.
  4. If stock CLI produces this, capture logs and report a bug.

Example fix

// before
responses = append(responses, proposalResponse)
// after
if proposalResponse == nil { return errors.New("endorser returned nil response") }
responses = append(responses, proposalResponse)
Defensive patterns

Strategy: type-guard

Validate before calling

for _, resp := range endorserResponses {
    if resp == nil { return errors.New("endorser returned nil response") }
}

Type guard

func isNonNilResponse(r *pb.ProposalResponse) bool { return r != nil }

Try / catch

if err := commit(...); err != nil {
    if strings.Contains(err.Error(), "received nil proposal response") {
        // sanitize collected responses before calling Commit
    }
}

Prevention

When it happens

Trigger: The collected responses slice contains a nil *pb.ProposalResponse at index 0 — again indicative of a programming bug in the collection code rather than a normal runtime condition.

Common situations: Custom tooling appending unvalidated endorser results (including nils on endorse failure); test fixtures with nil entries; patched fabric code paths.

Related errors


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