# rpc error: code = DeadlineExceeded desc = context deadline exceeded

- **ID:** `go/grpc-deadline-exceeded-context`
- **Domain:** go
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The client-side or server-side context deadline elapsed before the RPC completed. Common when the server is slow, the network is congested, or the deadline is set too aggressively relative to the handler's work.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| google.golang.org/grpc v1.40+ | active | — | — |

## Workarounds

1. **** (85% success)
   ```
   ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
resp, err := client.Do(ctx, req)
if status.Code(err) == codes.DeadlineExceeded {
    // retry with backoff
}
   ```
2. **** (80% success)
   ```
   // measure handler latency, then set client deadline > p99
ctx, cancel := context.WithTimeout(ctx, p99Latency*2)
defer cancel()
   ```

## Dead Ends

- **** — If the server is genuinely overloaded, tight retries amplify load and worsen latency, causing more timeouts. No jitter means thundering herd. (80% fail)
- **** — Unbounded calls leak goroutines and hold connections indefinitely when the server hangs, eventually exhausting resources. (75% fail)
