{"record":{"id":"04fabb19e24ead5b","repo":"hyperledger/fabric","slug":"received-bad-response-status-d-s-04fabb","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/joinbysnapshotstatus.go","lineNumber":93,"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, due to %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\tjoinbysnapshotStatus := &pb.JoinBySnapshotStatus{}\n\terr = proto.Unmarshal(proposalResp.Response.Payload, joinbysnapshotStatus)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot query joinbysnapshot status, due to %s\", err)\n\t}\n\treturn joinbysnapshotStatus, nil\n}\n","sourceCodeStart":75,"sourceCodeEnd":103,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/channel/joinbysnapshotstatus.go#L75-L103","documentation":"Returned by joinBySnapshotStatus when the endorser responded but with a non-200 status (or a nil Response). The proposal was processed by the peer, but the chaincode-level execution rejected it; the peer's status code and message are included in the error.","triggerScenarios":"proposalResp.Response == nil or proposalResp.Response.Status != http.StatusOK — e.g. the peer returns 500 because the JoinBySnapshotStatus chaincode call failed internally, or 403/404 style errors from endorsement policy/unknown channel.","commonSituations":"The peer does not have the channel/snapshot context the command expects; chaincode handler on the peer errors out (snapshot metadata missing or join not in progress); client lacks permission to query; peer version doesn't support joinbysnapshot (feature not enabled).","solutions":["Read the status code and message embedded in the error for the peer-side reason","Verify the channel exists on the peer and a snapshot/join-by-snapshot operation is actually in progress","Ensure peer and CLI versions both support the joinbysnapshot feature (v3.x)","Check peer logs at the time of the request for the underlying chaincode error"],"exampleFix":"// before: querying status when no join-by-snapshot in progress -> peer returns 500\npeer channel joinbysnapshot status -c mychannel\n// after: verify state first / handle non-200 explicitly\nif resp.Response != nil && resp.Response.Status != http.StatusOK {\n    log.Printf(\"peer rejected status query (%d): %s\", resp.Response.Status, resp.Response.Message)\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func okEndorserResponse(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    // branch on status: 500 -> peer/chaincode issue; 403 -> permissions; retry only transient codes\n    return nil, fmt.Errorf(\"received bad response, status %d: %s\", proposalResp.Response.Status, proposalResp.Response.Message)\n}","preventionTips":["Confirm the join-by-snapshot operation is actually in progress before querying status","Match peer and CLI versions (joinbysnapshot requires Fabric 3.x)","Read the embedded status message before changing configuration","Monitor peer logs when automating these queries"],"tags":["fabric","endorser","chaincode","http-status"],"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"}