{"record":{"id":"1487371caa06ebc5","repo":"hyperledger/fabric","slug":"failing-extracting-proposal-during-check-policy-on","errorCode":null,"errorMessage":"Failing extracting proposal during check policy on channel [%s] with policy [%s]: [%s]","messagePattern":"Failing extracting proposal during check policy on channel \\[(.+?)\\] with policy \\[(.+?)\\]: \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/policy/policy.go","lineNumber":83,"sourceCode":"\n\tif policyName == \"\" {\n\t\treturn fmt.Errorf(\"Invalid policy name during check policy on channel [%s]. Name must be different from nil.\", channelID)\n\t}\n\n\tif signedProp == nil {\n\t\treturn fmt.Errorf(\"Invalid signed proposal during check policy on channel [%s] with policy [%s]\", channelID, policyName)\n\t}\n\n\t// Get Policy\n\tpolicyManager := p.channelPolicyManagerGetter.Manager(channelID)\n\tif policyManager == nil {\n\t\treturn fmt.Errorf(\"Failed to get policy manager for channel [%s]\", channelID)\n\t}\n\n\t// Prepare SignedData\n\tproposal, err := protoutil.UnmarshalProposal(signedProp.ProposalBytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failing extracting proposal during check policy on channel [%s] with policy [%s]: [%s]\", channelID, policyName, err)\n\t}\n\n\theader, err := protoutil.UnmarshalHeader(proposal.Header)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failing extracting header during check policy on channel [%s] with policy [%s]: [%s]\", channelID, policyName, err)\n\t}\n\n\tshdr, err := protoutil.UnmarshalSignatureHeader(header.SignatureHeader)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Invalid Proposal's SignatureHeader during check policy on channel [%s] with policy [%s]: [%s]\", channelID, policyName, err)\n\t}\n\n\tsd := []*protoutil.SignedData{{\n\t\tData:      signedProp.ProposalBytes,\n\t\tIdentity:  shdr.Creator,\n\t\tSignature: signedProp.Signature,\n\t}}\n","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/policy/policy.go#L65-L101","documentation":"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.","triggerScenarios":"Calling CheckPolicy (via Evaluate) with a SignedProposal whose ProposalBytes is nil/empty, corrupted in transit, or serialized by an incompatible protobuf version.","commonSituations":"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).","solutions":["Rebuild the SignedProposal using the official SDK proposal creation API so ProposalBytes is a correctly serialized pb.Proposal","Inspect the wrapped err in the message to identify whether bytes are empty or malformed","Check that no intermediary (proxy, chaincode handler) truncates or re-encodes ProposalBytes","Verify the client SDK and peer protobuf versions are compatible"],"exampleFix":"// before\nsignedProp := &pb.SignedProposal{ ProposalBytes: rawPayloadFromClient, Signature: sig }\n// after\nprop, _ := protoutil.Marshal(proposal)\nsignedProp := &pb.SignedProposal{ ProposalBytes: prop, Signature: sig }","handlingStrategy":"try-catch","validationCode":"// Java-style equivalent: validate ProposalBytes before invoking peer policy check\nif (proposalBytes == null || proposalBytes.length == 0) {\n    throw new IllegalArgumentException(\"ProposalBytes must be a serialized Proposal\");\n}","typeGuard":"function isValidSignedProposal(sp) {\n  return sp && sp.proposal_bytes && sp.proposal_bytes.length > 0;\n}","tryCatchPattern":"err := checker.CheckPolicy(policyName, signedProp)\nif err != nil {\n    if strings.Contains(err.Error(), \"Failing extracting proposal during check policy\") {\n        // treat as client protocol error: reject the proposal\n    }\n    return err\n}","preventionTips":["Build proposals only via SDK factories","Never mutate ProposalBytes after signing","Keep proto libraries in sync","Surface the wrapped cause in logs"],"tags":["hyperledger-fabric","protobuf","proposal","policy"],"backgroundTag":"protobuf-unmarshal-failed","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}