# fatal error: all goroutines are asleep - deadlock! (select with all nil channels)

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

## Root Cause

A select statement where all cases involve nil channels, causing the select to block forever.

## Version Compatibility

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

## Workarounds

1. **Initialize all channels before select** (100% success)
   ```
   ch1 := make(chan int)
ch2 := make(chan int)
select {
case <-ch1:
case <-ch2:
}
   ```
2. **Use a non-nil channel as a sentinel** (90% success)
   ```
   ch := make(chan int)
close(ch) // closed channel always returns zero value
select {
case <-ch:
}
   ```

## Dead Ends

- **Add a default case to select** — Default case will execute immediately, which may not be desired; also doesn't fix the nil channel issue. (50% fail)
- **Check each channel for nil before select** — Can become cumbersome; still need to handle nil channels properly. (60% fail)
