{"record":{"id":"753902fd8740d886","repo":"hyperledger/fabric","slug":"received-error-while-sending-message-ending-chain","errorCode":null,"errorMessage":"received error while sending message, ending chaincode support stream","messagePattern":"received error while sending message, ending chaincode support stream","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/handler.go","lineNumber":465,"sourceCode":"\t\t\t\tchaincodeLogger.Debugf(\"%+v\", err)\n\t\t\t\treturn err\n\t\t\tcase rmsg.msg == nil:\n\t\t\t\terr := errors.New(\"received nil message, ending chaincode support stream\")\n\t\t\t\tchaincodeLogger.Debugf(\"%+v\", err)\n\t\t\t\treturn err\n\t\t\tdefault:\n\t\t\t\terr := h.handleMessage(rmsg.msg)\n\t\t\t\tif err != nil {\n\t\t\t\t\terr = errors.WithMessage(err, \"error handling message, ending stream\")\n\t\t\t\t\tchaincodeLogger.Errorf(\"[%s] %+v\", shorttxid(rmsg.msg.Txid), err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tgo receiveMessage()\n\t\t\t}\n\n\t\tcase sendErr := <-h.errChan:\n\t\t\terr := errors.Wrapf(sendErr, \"received error while sending message, ending chaincode support stream\")\n\t\t\tchaincodeLogger.Errorf(\"%s\", err)\n\t\t\treturn err\n\t\tcase <-keepaliveCh:\n\t\t\t// if no error message from serialSend, KEEPALIVE happy, and don't care about error\n\t\t\t// (maybe it'll work later)\n\t\t\th.serialSendAsync(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_KEEPALIVE})\n\t\t\tcontinue\n\t\t}\n\t}\n}\n\n// sendReady sends READY to chaincode serially (just like REGISTER)\nfunc (h *Handler) sendReady() error {\n\tchaincodeLogger.Debugf(\"sending READY for chaincode %s\", h.chaincodeID)\n\n\tchaincodeAdditionalParams := &pb.ChaincodeAdditionalParams{\n\t\tUseWriteBatch:          h.UseWriteBatch,\n\t\tMaxSizeWriteBatch:      h.MaxSizeWriteBatch,","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/handler.go#L447-L483","documentation":"Returned by Handler.ProcessStream when the errChan receives a failure from the asynchronous send side of the chaincode stream. A write to the chaincode runtime failed, so the handler ends the stream wrapped with this context.","triggerScenarios":"Thrown at core/chaincode/handler.go:465 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped send error and chaincode logs","Restart the chaincode; tune gRPC keepalive/timeout settings if sends time out repeatedly"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}