# error: context canceled (goroutine blocked on channel send after cancellation)

- **ID:** `go/context-canceled-while-sending`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A goroutine keeps sending to a channel after its context is canceled, and the receiver has stopped draining, causing a block or lost work.

## Version Compatibility

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

## Workarounds

1. **** (94% success)
   ```
   select {
case ch <- v:
case <-ctx.Done():
    return ctx.Err()
}
   ```
2. **** (90% success)
   ```
   g, ctx := errgroup.WithContext(ctx)
g.Go(func() error { return producer(ctx, ch) })
return g.Wait()
   ```

## Dead Ends

- **** — Continues to block on a full channel and wastes resources; the cancellation is not honored. (80% fail)
- **** — Closing while senders are active panics with send on closed channel. (75% fail)
