# fatal error: all goroutines are asleep - deadlock! (select on nil channel)

- **ID:** `go/select-on-nil-channel-blocks`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A select statement with a nil channel case blocks forever because sending/receiving on nil channel blocks indefinitely.

## Version Compatibility

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

## Workarounds

1. **Initialize channels before using in select** (95% success)
   ```
   ch := make(chan int)
select {
case <-ch:
    // handle
case <-time.After(time.Second):
    // timeout
}
   ```
2. **Use a non-nil placeholder channel if channel may be nil** (85% success)
   ```
   if ch == nil { ch = make(chan int) } // but ensure it's used properly
   ```

## Dead Ends

- **Adding a default case to select** — Default case runs if all channels are nil, but if only some are nil, it may still block. (70% fail)
- **Checking channel for nil before select** — If channel becomes nil dynamically, race condition may occur. (80% fail)
