{"record":{"id":"cb40caf23edc416b","repo":"hyperledger/fabric","slug":"query-failed-with-status-d-s-cb40ca","errorCode":null,"errorMessage":"query failed with status: %d - %s","messagePattern":"query failed with status: (.+?) - (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/queryinstalled.go","lineNumber":127,"sourceCode":"\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed to create signed proposal\")\n\t}\n\n\tproposalResponse, err := i.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(i.Input.OutputFormat) == \"json\" {\n\t\treturn printResponseAsJSON(proposalResponse, &lb.QueryInstalledChaincodesResult{}, i.Writer)\n\t}\n\treturn i.printResponse(proposalResponse)\n}\n\n// printResponse prints the information included in the response\n// from the server.\nfunc (i *InstalledQuerier) printResponse(proposalResponse *pb.ProposalResponse) error {\n\tqicr := &lb.QueryInstalledChaincodesResult{}\n\terr := proto.Unmarshal(proposalResponse.Response.Payload, qicr)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmarshal proposal response's response payload\")\n\t}\n\tfmt.Fprintln(i.Writer, \"Installed chaincodes on peer:\")\n\tfor _, chaincode := range qicr.InstalledChaincodes {","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/queryinstalled.go#L109-L145","documentation":"Query checks the endorsement status; anything other than cb.Status_SUCCESS (200) produces this error carrying the peer's status code and message. The _lifecycle QueryInstalledChaincodes invocation was rejected or failed on the peer side.","triggerScenarios":"Peer-side failure of queryinstalled: caller lacks permission, peer internal error, or _lifecycle invocation rejected — Response.Status != 200 in the endorsement.","commonSituations":"ACLs denying the caller's role; peer still initializing/starting; TLS identity issues so the peer rejects the request; querying before any chaincode is installed (depending on peer version this can yield an error status).","solutions":["Read the status code/message in the error for the specific cause","Check peer logs for the endorser error","Verify the caller's identity satisfies lifecycle ACLs (e.g. _lifecycle/QueryInstalledChaincodes policy)","Retry after the peer finishes startup if it was mid-boot"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-checks: peer joined to channel, caller MSP satisfies lifecycle ACLs\n// peer channel list && peer lifecycle chaincode installed --peerAddress ...","typeGuard":null,"tryCatchPattern":"if err := q.Query(); err != nil {\n    if m := regexp.MustCompile(`status: (\\d+) - (.*)`).FindStringSubmatch(err.Error()); m != nil {\n        code, _ := strconv.Atoi(m[1])\n        if code == 500 { return fmt.Errorf(\"peer internal error: %s\", m[2]) }\n        if code == 403 { return fmt.Errorf(\"access denied by ACL: %s\", m[2]) }\n    }\n    return err\n}","preventionTips":["Review the _lifecycle/QueryInstalledChaincodes ACL policy","Ensure the client identity/ MSP is correctly configured (TLS + membership)","Wait for peer startup to complete before querying","Check peer logs when a non-200 status appears"],"tags":["fabric","lifecycle","endorsement-status","acl"],"backgroundTag":"query-failed-status","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}