# fatal error: all goroutines are asleep - deadlock! (goroutine 1 [chan receive (nil chan)])

- **ID:** `go/nil-channel-block-forever`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Sending or receiving on a nil channel blocks forever. This happens when a channel variable is not initialized before use.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.18 | active | — | — |
| 1.22 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   ch := make(chan int) // or with buffer: make(chan int, 10)
   ```
2. **** (85% success)
   ```
   var ch chan int
select {
case v := <-ch:
    // will not execute if ch is nil
case <-time.After(time.Second):
    // handle timeout
}
   ```

## Dead Ends

- **** — The default case may execute incorrectly, and the nil channel still blocks if not handled properly. (80% fail)
- **** — Nil channel is a different type; assigning doesn't initialize it. (90% fail)
