hyperledger/fabric · error
error unmarshalling ProposalResponsePayload
Error message
error unmarshalling ProposalResponsePayload
What it means
Returned by protoutil.UnmarshalProposalResponsePayload when proto.Unmarshal cannot decode bytes into a peer.ProposalResponsePayload. The wrapper adds message-type context to the protobuf error. It means the payload bytes (proposal hash + extension) are not a valid ProposalResponsePayload encoding.
Source
Thrown at protoutil/unmarshalers.go:144
// UnmarshalResponse unmarshals bytes to a Response
func UnmarshalResponse(resBytes []byte) (*peer.Response, error) {
response := &peer.Response{}
err := proto.Unmarshal(resBytes, response)
return response, errors.Wrap(err, "error unmarshalling Response")
}
// UnmarshalChaincodeEvents unmarshals bytes to a ChaincodeEvent
func UnmarshalChaincodeEvents(eBytes []byte) (*peer.ChaincodeEvent, error) {
chaincodeEvent := &peer.ChaincodeEvent{}
err := proto.Unmarshal(eBytes, chaincodeEvent)
return chaincodeEvent, errors.Wrap(err, "error unmarshalling ChaicnodeEvent")
}
// UnmarshalProposalResponsePayload unmarshals bytes to a ProposalResponsePayload
func UnmarshalProposalResponsePayload(prpBytes []byte) (*peer.ProposalResponsePayload, error) {
prp := &peer.ProposalResponsePayload{}
err := proto.Unmarshal(prpBytes, prp)
return prp, errors.Wrap(err, "error unmarshalling ProposalResponsePayload")
}
// UnmarshalProposal unmarshals bytes to a Proposal
func UnmarshalProposal(propBytes []byte) (*peer.Proposal, error) {
prop := &peer.Proposal{}
err := proto.Unmarshal(propBytes, prop)
return prop, errors.Wrap(err, "error unmarshalling Proposal")
}
// UnmarshalTransaction unmarshals bytes to a Transaction
func UnmarshalTransaction(txBytes []byte) (*peer.Transaction, error) {
tx := &peer.Transaction{}
err := proto.Unmarshal(txBytes, tx)
return tx, errors.Wrap(err, "error unmarshalling Transaction")
}
// UnmarshalChaincodeActionPayload unmarshals bytes to a ChaincodeActionPayload
func UnmarshalChaincodeActionPayload(capBytes []byte) (*peer.ChaincodeActionPayload, error) {View on GitHub (pinned to 2736b63f8f)
Solutions
- Ensure you pass Cap.Action.ProposalResponsePayload (the action's Result field), not envelope/payload-level bytes.
- Verify parent structures unmarshal successfully first (Envelope -> Payload -> Transaction).
- Check non-empty, non-truncated input; log length and base64 of failing bytes.
- Align Fabric versions between the peer that produced the transaction and the parser.
- Fail the transaction validation cleanly with context instead of proceeding on a zero-value payload.
Example fix
// before
prp, _ := protoutil.UnmarshalProposalResponsePayload(env.Payload)
// after
act := tx.Actions[0].Payload
cha, _ := protoutil.UnmarshalChaincodeActionPayload(act)
prp, err := protoutil.UnmarshalProposalResponsePayload(cha.Action.ProposalResponsePayload)
if err != nil {
return fmt.Errorf("bad proposal response payload: %w", err)
} Defensive patterns
Strategy: validation
Validate before calling
func validPRP(cha *peer.ChaincodeActionPayload) bool {
return cha != nil && cha.Action != nil && len(cha.Action.ProposalResponsePayload) > 0
} Type guard
func isProposalResponsePayload(v any) bool {
_, ok := v.(*peer.ProposalResponsePayload)
return ok
} Try / catch
prp, err := protoutil.UnmarshalProposalResponsePayload(cha.Action.ProposalResponsePayload)
if err != nil {
return fmt.Errorf("invalid action payload (%d bytes): %w", len(cha.Action.ProposalResponsePayload), err)
} Prevention
- Drill down Envelope->Payload->Transaction->ChaincodeActionPayload before extracting Result
- Never pass envelope/payload-level bytes to this API
- Verify non-empty input and log lengths on failure
- Align Fabric versions between producing peer and validating peer
When it happens
Trigger: Calling UnmarshalProposalResponsePayload on the Result field of a TransactionAction that is empty, truncated, or of another type; reached from transaction validation (validateEndorserTransaction, extractDependenciesForTx, ValidateLSCCInvocation) and endorsement processing.
Common situations: VSCC-style validation of committed transactions where action results were corrupted; parsing transactions from a different Fabric version; extracting the wrong field (action vs payload) in custom block parsers.
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
- GetProposalResponsePayload error %s
- GetChaincodeAction error %s
- error unmarshalling ProposalResponse
- error unmarshalling ChaincodeAction
- error unmarshalling Transaction
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/41fda88e3ccbb5df.
Report an issue: GitHub.