{"record":{"id":"781dd0ca48cee668","repo":"hyperledger/fabric","slug":"received-nil-message-ending-chaincode-support-str","errorCode":null,"errorMessage":"received nil message, ending chaincode support stream","messagePattern":"received nil message, ending chaincode support stream","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/handler.go","lineNumber":450,"sourceCode":"\t\tin, err := h.chatStream.Recv()\n\t\tmsgAvail <- &recvMsg{in, err}\n\t}\n\n\tgo receiveMessage()\n\tfor {\n\t\tselect {\n\t\tcase rmsg := <-msgAvail:\n\t\t\tswitch {\n\t\t\t// Defer the deregistering of the this handler.\n\t\t\tcase rmsg.err == io.EOF:\n\t\t\t\tchaincodeLogger.Debugf(\"received EOF, ending chaincode support stream: %s\", rmsg.err)\n\t\t\t\treturn rmsg.err\n\t\t\tcase rmsg.err != nil:\n\t\t\t\terr := errors.Wrap(rmsg.err, \"receive from chaincode support stream failed\")\n\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:","sourceCodeStart":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/handler.go#L432-L468","documentation":"Returned by Handler.ProcessStream when the chat stream yields a nil message with no transport error — a protocol violation on the chaincode gRPC stream. The handler deliberately terminates the stream rather than loop on empty messages.","triggerScenarios":"Thrown at core/chaincode/handler.go:450 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restart the chaincode to re-establish a well-behaved stream","Check shim implementation/version for the nil-message bug"],"exampleFix":null,"handlingStrategy":"validation","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"}