# error: channel closed but reads return zero values indefinitely

- **ID:** `go/receive-on-closed-channel-loop`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Reading from a closed channel never blocks; it returns the zero value and ok=false immediately. A for-range loop only exits when the channel is closed, but a manual <-ch in a loop spins forever.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   for {
    v, ok := <-ch
    if !ok { break }
    process(v)
}
   ```
2. **** (98% success)
   ```
   for v := range ch {
    process(v)
}
   ```

## Dead Ends

- **** — Reduces CPU burn but the loop still never terminates; the program hangs and leaks goroutines. (90% fail)
- **** — len returns buffered items, not closure state. A closed empty channel has len 0, same as an open empty one. (85% fail)
