# rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR

- **ID:** `go/grpc-internal-stream-terminated`
- **Domain:** go
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

HTTP/2 stream reset by the peer, often caused by server-side panic in a handler, exceeding flow control, or a proxy (Envoy/nginx) resetting the connection.

## Version Compatibility

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

## Workarounds

1. **** (88% success)
   ```
   func recoverInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, h grpc.UnaryHandler) (any, error) {
  defer func() { if r := recover(); r != nil { log.Printf("panic: %v", r) } }()
  return h(ctx, req)
}
s := grpc.NewServer(grpc.UnaryInterceptor(recoverInterceptor))
   ```
2. **** (70% success)
   ```
   // Envoy example: set stream_idle_timeout: 0s or raise it in HttpConnectionManager config
   ```

## Dead Ends

- **** — If a handler panics deterministically, every stream resets. (80% fail)
- **** — gRPC requires HTTP/2; disabling it breaks all calls. (95% fail)
