# rpc error: code = Internal desc = grpc: failed to send message: stream terminated by RST_STREAM

- **ID:** `go/grpc-stream-send-after-close`
- **Domain:** go
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A server-streaming or bidi-streaming handler called Send after the stream was already closed by the client or by an earlier error. The HTTP/2 stream was reset.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.x | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   Check the error from Send and return immediately: if err := stream.Send(msg); err != nil { return status.Errorf(codes.Internal, "send: %v", err) }.
   ```
2. **** (88% success)
   ```
   Watch ctx.Done() in the streaming loop and exit gracefully when the client disconnects: select { case <-ctx.Done(): return ctx.Err(); default: }.
   ```

## Dead Ends

- **** — Once the stream is reset, every subsequent Send fails; continuing wastes CPU and delays cleanup. (85% fail)
- **** — CloseSend signals end of client sends; calling it mid-stream terminates the stream prematurely. (90% fail)
