hyperledger/fabric · error

Failing extracting proposal during check policy on channel

Error message

Failing extracting proposal during check policy on channel [%s] with policy [%s]: [%s]

What it means

In CheckPolicy, the SignedProposal's ProposalBytes field is unmarshalled into a pb.Proposal via protoutil.UnmarshalProposal. If the bytes are empty, truncated, or not a valid serialized Proposal protobuf, the check policy flow aborts with this wrapped error, including the channel ID, policy name, and the underlying unmarshal error.

Solutions

  1. Rebuild the SignedProposal using the official SDK proposal creation API so ProposalBytes is a correctly serialized pb.Proposal
  2. Inspect the wrapped err in the message to identify whether bytes are empty or malformed
  3. Check that no intermediary (proxy, chaincode handler) truncates or re-encodes ProposalBytes
  4. Verify the client SDK and peer protobuf versions are compatible

Example fix

// before
signedProp := &pb.SignedProposal{ ProposalBytes: rawPayloadFromClient, Signature: sig }
// after
prop, _ := protoutil.Marshal(proposal)
signedProp := &pb.SignedProposal{ ProposalBytes: prop, Signature: sig }
Defensive patterns

Strategy: try-catch

Validate before calling

// Java-style equivalent: validate ProposalBytes before invoking peer policy check
if (proposalBytes == null || proposalBytes.length == 0) {
    throw new IllegalArgumentException("ProposalBytes must be a serialized Proposal");
}

Type guard

function isValidSignedProposal(sp) {
  return sp && sp.proposal_bytes && sp.proposal_bytes.length > 0;
}

Try / catch

err := checker.CheckPolicy(policyName, signedProp)
if err != nil {
    if strings.Contains(err.Error(), "Failing extracting proposal during check policy") {
        // treat as client protocol error: reject the proposal
    }
    return err
}

Prevention

When it happens

Trigger: Calling CheckPolicy (via Evaluate) with a SignedProposal whose ProposalBytes is nil/empty, corrupted in transit, or serialized by an incompatible protobuf version.

Common situations: Clients building the SignedProposal manually instead of using the SDK's proposal factory; a gateway/proxy mangling the proposal payload; protobuf/marshaling mismatches between client SDK and peer (e.g. proto3 vs legacy opaque Proposal bytes).

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/1487371caa06ebc5. Report an issue: GitHub.

Appendix: source

Thrown at core/policy/policy.go:83

	if policyName == "" {
		return fmt.Errorf("Invalid policy name during check policy on channel [%s]. Name must be different from nil.", channelID)
	}

	if signedProp == nil {
		return fmt.Errorf("Invalid signed proposal during check policy on channel [%s] with policy [%s]", channelID, policyName)
	}

	// Get Policy
	policyManager := p.channelPolicyManagerGetter.Manager(channelID)
	if policyManager == nil {
		return fmt.Errorf("Failed to get policy manager for channel [%s]", channelID)
	}

	// Prepare SignedData
	proposal, err := protoutil.UnmarshalProposal(signedProp.ProposalBytes)
	if err != nil {
		return fmt.Errorf("Failing extracting proposal during check policy on channel [%s] with policy [%s]: [%s]", channelID, policyName, err)
	}

	header, err := protoutil.UnmarshalHeader(proposal.Header)
	if err != nil {
		return fmt.Errorf("Failing extracting header during check policy on channel [%s] with policy [%s]: [%s]", channelID, policyName, err)
	}

	shdr, err := protoutil.UnmarshalSignatureHeader(header.SignatureHeader)
	if err != nil {
		return fmt.Errorf("Invalid Proposal's SignatureHeader during check policy on channel [%s] with policy [%s]: [%s]", channelID, policyName, err)
	}

	sd := []*protoutil.SignedData{{
		Data:      signedProp.ProposalBytes,
		Identity:  shdr.Creator,
		Signature: signedProp.Signature,
	}}

View on GitHub (pinned to 2736b63f8f)