hyperledger/fabric · error

Failing extracting proposal during channelless check policy

Error message

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

What it means

This error is thrown by CheckPolicyNoChannel in Hyperledger Fabric's peer when the bytes of a signed proposal cannot be unmarshaled into a Proposal protobuf. The channelless (system-chaincode style) policy check verifies proposal signatures without a channel context, and the first step is extracting the Proposal from SignedProp.ProposalBytes. If those bytes are corrupt, truncated, or not a serialized Proposal, protoutil.UnmarshalProposal fails and this error is returned with the underlying parse error embedded.

Source

Thrown at core/policy/policy.go:118

	}}

	return p.CheckPolicyBySignedData(channelID, policyName, sd)
}

// CheckPolicyNoChannel checks that the passed signed proposal is valid with the respect to
// passed policy on the local MSP.
func (p *policyChecker) CheckPolicyNoChannel(policyName string, signedProp *pb.SignedProposal) error {
	if policyName == "" {
		return errors.New("Invalid policy name during channelless check policy. Name must be different from nil.")
	}

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

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

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

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

	// Deserialize proposal's creator with the local MSP
	id, err := p.localMSP.DeserializeIdentity(shdr.Creator)
	if err != nil {
		logger.Warnw("Failed deserializing proposal creator during channelless check policy", "error", err, "policyName", policyName, "identity", protoutil.LogMessageForSerializedIdentity(shdr.Creator))
		return fmt.Errorf("Failed deserializing proposal creator during channelless check policy with policy [%s]: [%s]", policyName, err)
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Verify the client builds the SignedProposal with the correct protos: ProposalBytes must marshal common.Proposal (Header + Payload), not the SignedProposal itself or other message types.
  2. Re-generate or re-sync proto files with the Fabric version the peer runs so both sides serialize identically.
  3. Log/inspect the raw ProposalBytes length and hex on the client side to confirm non-empty, intact bytes reach the peer.
  4. Check for intermediaries (proxies, gateways) that might mangle the request body before it reaches the peer.

Example fix

// before: stuffing the wrong message into ProposalBytes
sp := &common.SignedProposal{ProposalBytes: signedProposalBytes}

// after: marshal the Proposal correctly
propBytes, err := protoutil.Marshal(proposal)
if err != nil { return err }
sp := &common.SignedProposal{ProposalBytes: propBytes, Signature: sig}
Defensive patterns

Strategy: validation

Validate before calling

if signedProp == nil || len(signedProp.ProposalBytes) == 0 {
    return errors.New("signed proposal has empty ProposalBytes")
}
if _, err := protoutil.UnmarshalProposal(signedProp.ProposalBytes); err != nil {
    return fmt.Errorf("ProposalBytes are not a valid Proposal: %w", err)
}

Type guard

func isValidSignedProposal(sp *peer.SignedProposal) bool {
    if sp == nil || len(sp.ProposalBytes) == 0 || len(sp.Signature) == 0 {
        return false
    }
    _, err := protoutil.UnmarshalProposal(sp.ProposalBytes)
    return err == nil
}

Try / catch

err := policyMgr.CheckPolicy(policyName, signedProp)
var perr *invalidProposalError
if errors.As(err, &perr) { /* rebuild/reserialize proposal on client */ }

Prevention

When it happens

Trigger: Calling peer/policy CheckPolicy (or CheckPolicyNoChannel) with a SignedProp whose ProposalBytes are not a valid protobuf-encoded common.Proposal — e.g. bytes from a different message type, empty/nil payload after transport corruption, or a hand-crafted proposal built with mismatched proto schemas.

Common situations: Custom clients (Fabric SDK or raw gRPC) constructing SignedProposal manually with wrong proto serialization; intermediate proxies truncating or re-encoding gRPC frames; version skew where client proto definitions differ from the peer's protos.

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/8306a5f3757cfa6b. Report an issue: GitHub.