# INTERNAL: grpc: max concurrent streams exceeded on server

- **ID:** `grpc/grpc-max-concurrent-streams-exceeded`
- **Domain:** grpc
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Server's HTTP/2 max concurrent streams limit (default 100) is reached, and new streams are rejected.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| grpc-go 1.61.0 | active | — | — |
| grpc-java 1.60.0 | active | — | — |
| envoy 1.27.0 | active | — | — |
| nginx 1.25.0 | active | — | — |

## Workarounds

1. **Increase the server's max concurrent streams limit. In gRPC-Go, use:
  import "google.golang.org/grpc"
  s := grpc.NewServer(grpc.MaxConcurrentStreams(200))
  Or set environment variable GRPC_GO_MAX_CONCURRENT_STREAMS=200 before starting the server.** (85% success)
   ```
   Increase the server's max concurrent streams limit. In gRPC-Go, use:
  import "google.golang.org/grpc"
  s := grpc.NewServer(grpc.MaxConcurrentStreams(200))
  Or set environment variable GRPC_GO_MAX_CONCURRENT_STREAMS=200 before starting the server.
   ```
2. **Reduce the number of long-lived streams by batching requests or using unary RPCs instead of streaming. Alternatively, add more server instances behind a load balancer to distribute streams.** (75% success)
   ```
   Reduce the number of long-lived streams by batching requests or using unary RPCs instead of streaming. Alternatively, add more server instances behind a load balancer to distribute streams.
   ```

## Dead Ends

- **** — The limit is on the server side per connection; client pool size doesn't affect server stream limits. (85% fail)
- **** — Stream count is unrelated to message size; this does not free up stream slots. (90% fail)
