{"record":{"id":"f9190a37d1b20ceb","repo":"hyperledger/fabric","slug":"failed-to-unmarshal-proposal-response-s-response-p-f9190a","errorCode":null,"errorMessage":"failed to unmarshal proposal response's response payload","messagePattern":"failed to unmarshal proposal response's response payload","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/getinstalledpackage.go","lineNumber":153,"sourceCode":"\t\treturn errors.New(\"received nil proposal response\")\n\t}\n\n\tif proposalResponse.Response == nil {\n\t\treturn errors.New(\"received proposal response with nil response\")\n\t}\n\n\tif proposalResponse.Response.Status != int32(cb.Status_SUCCESS) {\n\t\treturn errors.Errorf(\"proposal failed with status: %d - %s\", proposalResponse.Response.Status, proposalResponse.Response.Message)\n\t}\n\n\treturn i.writePackage(proposalResponse)\n}\n\nfunc (i *InstalledPackageGetter) writePackage(proposalResponse *pb.ProposalResponse) error {\n\tresult := &lb.GetInstalledChaincodePackageResult{}\n\terr := proto.Unmarshal(proposalResponse.Response.Payload, result)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmarshal proposal response's response payload\")\n\t}\n\n\toutputFile := filepath.Join(i.Input.OutputDirectory, i.Input.PackageID+\".tar.gz\")\n\n\tdir, name := filepath.Split(outputFile)\n\t// translate dir into absolute path\n\tif dir, err = filepath.Abs(dir); err != nil {\n\t\treturn err\n\t}\n\n\terr = i.Writer.WriteFile(dir, name, result.ChaincodeInstallPackage)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"failed to write chaincode package to %s\", outputFile)\n\t\tlogger.Error(err.Error())\n\t\treturn err\n\t}\n\n\treturn nil","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/getinstalledpackage.go#L135-L171","documentation":"In writePackage(), the payload of a successful proposal response could not be proto-unmarshaled into lb.GetInstalledChaincodePackageResult. It means the peer returned success status but its payload bytes are not the expected protobuf message — typically an incompatible peer version or a corrupted response.","triggerScenarios":"proto.Unmarshal(proposalResponse.Response.Payload, result) returns an error after Get() received a SUCCESS-status response; the payload was produced by a peer whose _lifecycle result schema differs from the client's protos.","commonSituations":"Client binaries (peer CLI) are a different Fabric version than the peer node; a proxy/middleware mangled or truncated the response payload; custom peer builds returning non-standard payloads.","solutions":["Match the peer CLI binary version to the Fabric peer version it connects to.","Re-run the command to rule out a transient/corrupted response.","Check for intermediaries (proxies, service meshes) altering gRPC response bodies.","Inspect peer logs to confirm what the peer actually serialized."],"exampleFix":"// before: v2.2 peer CLI against v2.5 peer\n./peer-2.2 lifecycle chaincode getinstalledpackage ...\n// after: aligned versions\n./peer-2.5 lifecycle chaincode getinstalledpackage ...","handlingStrategy":"try-catch","validationCode":"if len(proposalResponse.Response.Payload) == 0 {\n    return errors.New(\"empty proposal response payload\")\n}","typeGuard":"func isPkgResult(b []byte) (*lb.GetInstalledChaincodePackageResult, bool) {\n    r := &lb.GetInstalledChaincodePackageResult{}\n    if proto.Unmarshal(b, r) != nil { return nil, false }\n    return r, true\n}","tryCatchPattern":"if err := writePackage(resp); err != nil {\n    if strings.Contains(err.Error(), \"failed to unmarshal\") {\n        // upgrade/realign CLI version and retry\n    }\n    return err\n}","preventionTips":["Use peer CLI matching the peer's Fabric version","Avoid proxies that rewrite gRPC payloads","Retry once on unmarshal failures","Pin official Fabric release binaries"],"tags":["fabric","protobuf","unmarshal","version-mismatch"],"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"}