# fatal error: all goroutines are asleep - deadlock!

- **ID:** `go/deadlock-on-unbuffered-channel-send`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Sending on an unbuffered channel without a corresponding receiver in the same goroutine causes a deadlock.

## Version Compatibility

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

## Workarounds

1. **Ensure a separate goroutine receives from the channel before sending** (95% success)
   ```
   go func() { <-ch }(); ch <- data
   ```
2. **Use a buffered channel with sufficient capacity** (90% success)
   ```
   ch := make(chan int, 1); ch <- 42
   ```

## Dead Ends

- **Adding a small sleep before sending** — Sleep does not create a receiver; the send still blocks indefinitely. (90% fail)
- **Using a buffered channel with capacity 1 but still no receiver** — Buffered channel only helps if capacity is not exceeded; if no receiver, the send blocks after buffer fills. (80% fail)
