{"record":{"id":"c58dc1747f0df609","repo":"hyperledger/fabric","slug":"proposal-response-was-not-successful-error-code","errorCode":null,"errorMessage":"proposal response was not successful, error code %d, msg %s","messagePattern":"proposal response was not successful, error code (.+?), msg (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoutil/txutils.go","lineNumber":182,"sourceCode":"\tsignerBytes, err := signer.Serialize()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tshdr, err := UnmarshalSignatureHeader(hdr.SignatureHeader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !bytes.Equal(signerBytes, shdr.Creator) {\n\t\treturn nil, errors.New(\"signer must be the same as the one referenced in the header\")\n\t}\n\n\t// ensure that all actions are bitwise equal and that they are successful\n\tvar a1 []byte\n\tfor n, r := range resps {\n\t\tif r.Response.Status < 200 || r.Response.Status >= 400 {\n\t\t\treturn nil, errors.Errorf(\"proposal response was not successful, error code %d, msg %s\", r.Response.Status, r.Response.Message)\n\t\t}\n\n\t\tif n == 0 {\n\t\t\ta1 = r.Payload\n\t\t\tcontinue\n\t\t}\n\n\t\tif !bytes.Equal(a1, r.Payload) {\n\t\t\treturn nil, errors.Errorf(\"ProposalResponsePayloads do not match (base64): '%s' vs '%s'\",\n\t\t\t\tb64.StdEncoding.EncodeToString(r.Payload), b64.StdEncoding.EncodeToString(a1))\n\t\t}\n\t}\n\n\t// fill endorsements according to their uniqueness\n\tendorsersUsed := make(map[string]struct{})\n\tvar endorsements []*peer.Endorsement\n\tfor _, r := range resps {\n\t\tif r.Endorsement == nil {","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/protoutil/txutils.go#L164-L200","documentation":"CreateSignedTx validates that every proposal response has a successful status code (200-399). If any response reports an error status, the transaction cannot proceed and the error includes the peer's status code and message, which come from chaincode execution or endorser rejection.","triggerScenarios":"A chaincode invocation returned an error status (e.g. 500 with 'transaction returned with failure') or an endorser rejected the proposal (e.g. 400 for MVCC conflict, endorsement policy failure), and the caller still tries to assemble a transaction.","commonSituations":"Chaincode returned an error from Invoke; read-write set conflicts (MVCC_READ_CONFLICT) under concurrency; endorsement policy violations; chaincode container errors/timeout.","solutions":["Inspect r.Response.Status and r.Response.Message to find the chaincode/endorsement failure cause","Fix the chaincode logic or the invoke arguments that caused the failure status","For MVCC conflicts, retry the transaction or reduce key contention","Ensure all collected responses are successful and consistent before calling CreateSignedTx"],"exampleFix":"// before\nenv, err := protoutil.CreateSignedTx(proposal, signer, resps...) // one resp has status 500\n// after\nfor _, r := range resps {\n    if r.Response.Status < 200 || r.Response.Status >= 400 {\n        return nil, fmt.Errorf(\"endorsement failed (%d): %s\", r.Response.Status, r.Response.Message)\n    }\n}\nenv, err := protoutil.CreateSignedTx(proposal, signer, resps...)","handlingStrategy":"validation","validationCode":"func allResponsesSuccessful(resps []*peer.ProposalResponse) error {\n    for _, r := range resps {\n        if r.Response.Status < 200 || r.Response.Status >= 400 {\n            return fmt.Errorf(\"endorsement %d: %s\", r.Response.Status, r.Response.Message)\n        }\n    }\n    return nil\n}","typeGuard":"func isSuccess(r *peer.ProposalResponse) bool {\n    return r != nil && r.Response != nil && r.Response.Status >= 200 && r.Response.Status < 400\n}","tryCatchPattern":"if err := allResponsesSuccessful(resps); err != nil {\n    // inspect status/message, retry invoke or surface chaincode error\n    return nil, err\n}\ntx, err := protoutil.CreateSignedTx(proposal, signer, resps...)","preventionTips":["Check Response.Status on every endorsement before tx assembly","Handle MVCC_READ_CONFLICT with retries/backoff","Fix or wrap chaincode errors so status codes are meaningful"],"tags":["chaincode","endorsement","hyperledger-fabric","transaction-failed"],"backgroundTag":"chaincode-invoke-failed","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"}