# panic: runtime error: receive from nil channel

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

## Root Cause

Attempting to receive from a channel that is nil, causing permanent block, but if in select with default, it may not panic; however, direct receive panics.

## Version Compatibility

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

## Workarounds

1. **Initialize channel before use** (100% success)
   ```
   ch := make(chan int); go func() { ch <- 1 }(); val := <-ch
   ```
2. **Use select with default to handle nil channel gracefully** (90% success)
   ```
   select { case val := <-ch: use(val); default: // skip }
   ```

## Dead Ends

- **Checking ch == nil before receive and returning** — Check prevents panic but may cause silent data loss. (30% fail)
- **Using recover to catch panic** — Panic is recoverable but indicates logic error; data not received. (50% fail)
