{"record":{"id":"6be0e56d12e02d93","repo":"hyperledger/fabric","slug":"query-failed-with-status-d-s-6be0e5","errorCode":null,"errorMessage":"query failed with status: %d - %s","messagePattern":"query failed with status: (.+?) - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/queryapproved.go","lineNumber":137,"sourceCode":"\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed to create signed proposal\")\n\t}\n\n\tproposalResponse, err := a.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(a.Input.OutputFormat) == \"json\" {\n\t\treturn a.printResponseAsJSON(proposalResponse)\n\t}\n\treturn a.printResponse(proposalResponse)\n}\n\nfunc (a *ApprovedQuerier) printResponseAsJSON(proposalResponse *pb.ProposalResponse) error {\n\tif a.Input.Name != \"\" {\n\t\treturn printResponseAsJSON(proposalResponse, &lb.QueryApprovedChaincodeDefinitionResult{}, a.Writer)\n\t}\n\treturn printResponseAsJSON(proposalResponse, &lb.QueryApprovedChaincodeDefinitionsResult{}, a.Writer)\n}\n\n// printResponse prints the information included in the response\n// from the server as human readable plain-text.\nfunc (a *ApprovedQuerier) printResponse(proposalResponse *pb.ProposalResponse) error {","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/queryapproved.go#L119-L155","documentation":"The proposal was endorsed and a response came back, but proposalResponse.Response.Status was not cb.Status_SUCCESS (200). The formatted status code and message describe why the peer rejected the query (e.g., chaincode not approved, no ledger, endorsement failure).","triggerScenarios":"Thrown at internal/peer/lifecycle/chaincode/queryapproved.go:137 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the numeric gRPC/status code and message embedded in the error to identify the peer-side cause","Confirm the chaincode is approved and committed on the channel","Check that the peer has joined the channel and its ledger is healthy"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}