# error: select on nil channel blocks forever

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

## Root Cause

Sending to or receiving from a nil channel blocks forever. In a select, a nil channel case is never ready, so if all cases are nil, the select blocks indefinitely.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   var ch chan int = make(chan int)
select {
case v := <-ch: _ = v
case <-time.After(time.Second):
}
   ```
2. **** (85% success)
   ```
   var never chan struct{} // nil disables the case
select {
case <-never:
case <-ch:
}
   ```

## Dead Ends

- **** — With default, the select always takes the default branch, so nothing ever happens; the intended wait is lost. (85% fail)
- **** — The outer select still holds the nil reference; the goroutine's new channel is unrelated. (75% fail)
