# fatal error: all goroutines are asleep - deadlock! (blocked in select {})

- **ID:** `go/select-no-cases-blocks`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

An empty select{} blocks the current goroutine forever, and if it is the only goroutine, the runtime deadlocks.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.18 | active | — | — |
| 1.22 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
<-ctx.Done()
   ```
2. **** (90% success)
   ```
   done := make(chan struct{})
go func(){ /* work */ close(done) }()
<-done
   ```
3. **** (93% success)
   ```
   for {
    select {
    case <-ctx.Done(): return
    case msg := <-msgs: handle(msg)
    }
}
   ```

## Dead Ends

- **** — Busy-waits and burns CPU; still no way to exit cleanly. (85% fail)
- **** — Same deadlock, just a spin loop; runtime still aborts if no other goroutine. (95% fail)
- **** — Moves the block elsewhere; leaked goroutine and no shutdown path. (80% fail)
