# gRPC error: DEADLINE_EXCEEDED: deadline exceeded waiting for stream response

- **ID:** `api/grpc-deadline-exceeded-streaming`
- **Domain:** api
- **Category:** runtime_error
- **Error Code:** `DEADLINE_EXCEEDED`
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

Client-set deadline (timeout) expired before the server finished sending all stream messages, often due to slow processing or network latency on long-lived streams.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| gRPC 1.58 | active | — | — |
| gRPC-Go 1.60 | active | — | — |
| gRPC-Java 1.61 | active | — | — |
| Envoy 1.28 | active | — | — |

## Workarounds

1. **Set a per-RPC deadline that matches expected stream duration. For server-streaming RPCs, use a longer deadline (e.g., 60s) and implement keepalive pings to detect dead connections.** (85% success)
   ```
   Set a per-RPC deadline that matches expected stream duration. For server-streaming RPCs, use a longer deadline (e.g., 60s) and implement keepalive pings to detect dead connections.
   ```
2. **Implement server-side streaming with backpressure: use flow control to prevent the server from sending faster than the client can consume, reducing the risk of deadline exceeded due to buffering.** (80% success)
   ```
   Implement server-side streaming with backpressure: use flow control to prevent the server from sending faster than the client can consume, reducing the risk of deadline exceeded due to buffering.
   ```

## Dead Ends

- **** — Unbounded timeouts mask underlying performance issues and may cause resource leaks; the correct fix is per-stream or per-RPC tuning, not a global increase. (75% fail)
- **** — This removes timeout protection, leading to hung connections and resource exhaustion; gRPC requires deadlines for reliability. (90% fail)
