hyperledger/fabric · error

failed to unmarshal proposal response's response payload

Error message

failed to unmarshal proposal response's response payload

What it means

Raised while printing the query result: the payload bytes returned in the proposal response could not be unmarshalled into the expected lifecycle proto (QueryApprovedChaincodeDefinitionResult / QueryApprovedChaincodeDefinitionsResult). This is a guard inside the shared printResponseAsJSON helper; the at-fault input is the response payload, typically caused by a client/server proto schema mismatch.

Source

Thrown at internal/peer/lifecycle/chaincode/queryapproved.go:159

		return a.printResponseAsJSON(proposalResponse)
	}
	return a.printResponse(proposalResponse)
}

func (a *ApprovedQuerier) printResponseAsJSON(proposalResponse *pb.ProposalResponse) error {
	if a.Input.Name != "" {
		return printResponseAsJSON(proposalResponse, &lb.QueryApprovedChaincodeDefinitionResult{}, a.Writer)
	}
	return printResponseAsJSON(proposalResponse, &lb.QueryApprovedChaincodeDefinitionsResult{}, a.Writer)
}

// printResponse prints the information included in the response
// from the server as human readable plain-text.
func (a *ApprovedQuerier) printResponse(proposalResponse *pb.ProposalResponse) error {
	if a.Input.Name != "" {
		result := &lb.QueryApprovedChaincodeDefinitionResult{}
		if err := proto.Unmarshal(proposalResponse.Response.Payload, result); err != nil {
			return errors.Wrap(err, "failed to unmarshal proposal response's response payload")
		}
		fmt.Fprintf(a.Writer, "Approved chaincode definition for chaincode '%s' on channel '%s':\n", a.Input.Name, a.Input.ChannelID)
		a.printSingleApprovedChaincodeDefinition(result)
		fmt.Fprintf(a.Writer, "\n")
		return nil
	}

	result := &lb.QueryApprovedChaincodeDefinitionsResult{}
	if err := proto.Unmarshal(proposalResponse.Response.Payload, result); err != nil {
		return errors.Wrap(err, "failed to unmarshal proposal response's response payload")
	}
	fmt.Fprintf(a.Writer, "Approved chaincode definitions on channel '%s':\n", a.Input.ChannelID)

	for _, acd := range result.ApprovedChaincodeDefinitions {
		fmt.Fprintf(a.Writer, "name: %s, ", acd.Name)
		a.printSingleApprovedChaincodeDefinition(acd)
		fmt.Fprintf(a.Writer, "\n")
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Verify the peer CLI version matches the peer binary version
  2. Regenerate/verify the lifecycle protos in use
  3. Query the peer directly to inspect the raw payload if the mismatch persists
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/peer/lifecycle/chaincode/queryapproved.go:159 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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