# fatal error: all goroutines are asleep - deadlock! (context cancellation not propagated)

- **ID:** `go/goroutine-context-cancel-not-propagated`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A parent goroutine cancels a context but child goroutines are not listening to the context's Done channel, causing them to block indefinitely.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## Workarounds

1. **Use select to listen on context.Done() in blocking operations.** (95% success)
   ```
   select {
case result := <-ch:
    return result
case <-ctx.Done():
    return ctx.Err()
}
   ```
2. **Pass context to functions and check cancellation periodically.** (90% success)
   ```
   func worker(ctx context.Context) error {
    for {
        select {
        case <-ctx.Done():
            return ctx.Err()
        default:
            // do work
        }
    }
}
   ```

## Dead Ends

- **Only checking context.Err() without using select on Done.** — context.Err() is only set after cancellation; without select, goroutine may not wake up. (80% fail)
- **Passing context by value but not using it in select.** — The context is available but not used to unblock the goroutine. (70% fail)
