# context deadline exceeded

- **ID:** `go/context-deadline-exceeded-in-goroutine`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A goroutine using a context with a deadline did not complete in time; the derived context returns DeadlineExceeded.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   for {
    select {
    case <-ctx.Done():
        return ctx.Err()
    default:
        doChunk()
    }
}
   ```
2. **** (92% success)
   ```
   ctx, cancel := context.WithCancel(parent)
defer cancel()
   ```

## Dead Ends

- **** — Hides the underlying slowness; the deadline will eventually be hit again. (80% fail)
- **** — Downstream operations see a cancelled context and fail with different errors. (85% fail)
