{"record":{"id":"61067930e6e806da","repo":"hyperledger/fabric","slug":"received-bad-response-status-d-s-610679","errorCode":null,"errorMessage":"Received bad response, status %d: %s","messagePattern":"Received bad response, status (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/channel/list.go","lineNumber":73,"sourceCode":"\tc, _ := cc.cf.Signer.Serialize()\n\tprop, _, err = protoutil.CreateProposalFromCIS(common2.HeaderType_ENDORSER_TRANSACTION, \"\", invocation, c)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Cannot create proposal, due to %s\", err)\n\t}\n\n\tvar signedProp *pb.SignedProposal\n\tsignedProp, err = protoutil.GetSignedProposal(prop, cc.cf.Signer)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Cannot create signed proposal, due to %s\", err)\n\t}\n\n\tproposalResp, err := cc.cf.EndorserClient.ProcessProposal(context.Background(), signedProp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed sending proposal, got %s\", err)\n\t}\n\n\tif proposalResp.Response == nil || proposalResp.Response.Status != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"Received bad response, status %d: %s\", proposalResp.Response.Status, proposalResp.Response.Message)\n\t}\n\n\tvar channelQueryResponse pb.ChannelQueryResponse\n\terr = proto.Unmarshal(proposalResp.Response.Payload, &channelQueryResponse)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Cannot read channels list response, %s\", err)\n\t}\n\n\treturn channelQueryResponse.Channels, nil\n}\n\nfunc list(cf *ChannelCmdFactory) error {\n\tvar err error\n\tif cf == nil {\n\t\tcf, err = InitCmdFactory(EndorserRequired, PeerDeliverNotRequired, OrdererNotRequired)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/channel/list.go#L55-L91","documentation":"Returned by getChannels when the endorser replied but with a non-200 response status or a nil Response. The proposal reached the peer and was evaluated, yet the peer rejected the GetChannels query; its status code and message are interpolated into the error.","triggerScenarios":"proposalResp.Response == nil or proposalResp.Response.Status != http.StatusOK — the qscc GetChannels chaincode invocation failed on the peer (e.g. access denied for the caller's identity, system chaincode error, unknown/unavailable ledger).","commonSituations":"Caller's identity is not a member of any channel or lacks rights to invoke qscc; peer still initializing its ledger; peer and CLI version skew; response payload not produced because chaincode returned an error status.","solutions":["Read the embedded status and message for the peer-side reason","Ensure the client identity belongs to the organization/peer network (MSP membership)","Check peer logs around the request for the qscc failure","Verify peer binary and CLI are from compatible Fabric versions"],"exampleFix":"// before: non-member identity -> 403-style response\nif proposalResp.Response == nil || proposalResp.Response.Status != http.StatusOK {\n    return nil, fmt.Errorf(\"Received bad response, status %d: %s\", proposalResp.Response.Status, proposalResp.Response.Message)\n}\n// after: also log payload for diagnostics\nif proposalResp.Response == nil || proposalResp.Response.Status != http.StatusOK {\n    log.Printf(\"endorser response status=%d payload=%q\", proposalResp.Response.Status, string(proposalResp.Response.GetPayload()))\n    return nil, fmt.Errorf(\"Received bad response, status %d: %s\", proposalResp.Response.Status, proposalResp.Response.Message)\n}","handlingStrategy":"type-guard","validationCode":"// pre-flight: ensure identity is a network member (e.g. org enrolled and channel-joined)\nout, err := exec.Command(\"peer\", \"channel\", \"list\").CombinedOutput()\n_ = out; _ = err // membership errors surface as non-200 endorser responses","typeGuard":"func isOK(resp *pb.ProposalResponse) bool {\n    return resp != nil && resp.Response != nil && resp.Response.Status == http.StatusOK\n}","tryCatchPattern":"if proposalResp.Response == nil || proposalResp.Response.Status != http.StatusOK {\n    // 403/404-ish: identity/permission or channel unknown; 500: qscc failure -> check peer logs\n    return nil, fmt.Errorf(\"Received bad response, status %d: %s\", proposalResp.Response.Status, proposalResp.Response.Message)\n}","preventionTips":["Use an identity whose org is actually part of the network","Confirm the peer has joined at least one channel before listing","Keep peer and CLI on compatible Fabric versions","Capture the embedded status/message and correlate with peer logs"],"tags":["fabric","endorser","http-status","qscc"],"backgroundTag":"bad-endorser-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"}