hyperledger/fabric · error
query failed with status: %d - %s
Error message
query failed with status: %d - %s
What it means
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).
Source
Thrown at internal/peer/lifecycle/chaincode/queryapproved.go:137
if err != nil {
return errors.WithMessage(err, "failed to create signed proposal")
}
proposalResponse, err := a.EndorserClient.ProcessProposal(context.Background(), signedProposal)
if err != nil {
return errors.WithMessage(err, "failed to endorse proposal")
}
if proposalResponse == nil {
return errors.New("received nil proposal response")
}
if proposalResponse.Response == nil {
return errors.New("received proposal response with nil response")
}
if proposalResponse.Response.Status != int32(cb.Status_SUCCESS) {
return errors.Errorf("query failed with status: %d - %s", proposalResponse.Response.Status, proposalResponse.Response.Message)
}
if strings.ToLower(a.Input.OutputFormat) == "json" {
return a.printResponseAsJSON(proposalResponse)
}
return a.printResponse(proposalResponse)
}
func (a *ApprovedQuerier) printResponseAsJSON(proposalResponse *pb.ProposalResponse) error {
if a.Input.Name != "" {
return printResponseAsJSON(proposalResponse, &lb.QueryApprovedChaincodeDefinitionResult{}, a.Writer)
}
return printResponseAsJSON(proposalResponse, &lb.QueryApprovedChaincodeDefinitionsResult{}, a.Writer)
}
// printResponse prints the information included in the response
// from the server as human readable plain-text.
func (a *ApprovedQuerier) printResponse(proposalResponse *pb.ProposalResponse) error {View on GitHub (pinned to 2736b63f8f)
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
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at internal/peer/lifecycle/chaincode/queryapproved.go:137 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/6be0e56d12e02d93.
Report an issue: GitHub.