# error: context canceled

- **ID:** `go/context-canceled-propagation`
- **Domain:** go
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A parent context was canceled (or timed out) while a child operation was in progress. The error surfaces from HTTP clients, DB queries, or custom code checking ctx.Err().

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.7+ | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   if err := ctx.Err(); err != nil {
    return err
}
   ```
2. **** (85% success)
   ```
   retryCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
resp, err := client.Do(req.WithContext(retryCtx))
   ```

## Dead Ends

- **** — The context remains canceled; retries fail instantly without making a request. (95% fail)
- **** — Ignores the caller's shutdown intent; leaks work after the request is abandoned. (80% fail)
