{"record":{"id":"25f2eca26a8f6020","repo":"hyperledger/fabric","slug":"received-proposal-response-with-nil-response-25f2ec","errorCode":null,"errorMessage":"received proposal response with nil response","messagePattern":"received proposal response with nil response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/querycommitted.go","lineNumber":133,"sourceCode":"\t\treturn errors.WithMessage(err, \"failed to create proposal\")\n\t}\n\n\tsignedProposal, err := signProposal(proposal, c.Signer)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed to create signed proposal\")\n\t}\n\n\tproposalResponse, err := c.EndorserClient.ProcessProposal(context.Background(), signedProposal)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed to endorse proposal\")\n\t}\n\n\tif proposalResponse == nil {\n\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(\"query failed with status: %d - %s\", proposalResponse.Response.Status, proposalResponse.Response.Message)\n\t}\n\n\tif strings.ToLower(c.Input.OutputFormat) == \"json\" {\n\t\treturn c.printResponseAsJSON(proposalResponse)\n\t}\n\treturn c.printResponse(proposalResponse)\n}\n\nfunc (c *CommittedQuerier) printResponseAsJSON(proposalResponse *pb.ProposalResponse) error {\n\tif c.Input.Name != \"\" {\n\t\treturn printResponseAsJSON(proposalResponse, &lb.QueryChaincodeDefinitionResult{}, c.Writer)\n\t}\n\treturn printResponseAsJSON(proposalResponse, &lb.QueryChaincodeDefinitionsResult{}, c.Writer)\n}","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/querycommitted.go#L115-L151","documentation":"CommittedQuerier.Query validates the ProposalResponse returned by the peer's endorser before printing results. This error means the endorser returned a non-nil ProposalResponse whose nested Response field is nil, so the query result cannot be inspected. It is thrown as a defensive sanity check because a well-formed endorsement always carries a Response with status and payload.","triggerScenarios":"Calling 'peer lifecycle chaincode querycommitted' against a peer whose endorser returns a malformed/empty ProposalResponse (nil Response) after ProcessProposal succeeds.","commonSituations":"Buggy or non-standard peer implementation, proxy/middleware stripping response fields, corrupted gRPC message, or a peer version mismatch producing an incomplete endorsement.","solutions":["Verify peer and CLI Fabric versions match and the peer is a genuine Hyperledger Fabric endorser","Retry the query; transient gRPC/proxy corruption may produce a malformed response","Bypass proxies/load balancers and query the peer directly","Check peer logs for endorsement errors around the request time"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// before calling Query / after obtaining a ProposalResponse\nfunc validProposalResponse(pr *pb.ProposalResponse) bool {\n    return pr != nil && pr.Response != nil\n}","typeGuard":"func hasResponse(pr *pb.ProposalResponse) bool {\n    return pr != nil && pr.Response != nil\n}\n\nif !hasResponse(resp) {\n    return fmt.Errorf(\"endorser returned malformed proposal response\")\n}","tryCatchPattern":"if err := q.Query(); err != nil {\n    if strings.Contains(err.Error(), \"nil response\") {\n        // malformed endorsement: retry or re-verify peer\n        return retryQuery()\n    }\n    return err\n}","preventionTips":["Run stock, version-matched Fabric peers (v2.x) with the CLI","Avoid custom proxies that rewrite gRPC messages","Retry transient endorsement queries before failing hard"],"tags":["fabric","lifecycle","chaincode","grpc-response"],"backgroundTag":"nil-proposal-response","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"}