# fatal error: all goroutines are asleep - deadlock! (circular wait)

- **ID:** `go/deadlock-with-multiple-channels`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Multiple goroutines are waiting on each other's channels, forming a circular dependency that cannot be resolved.

## Version Compatibility

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

## Workarounds

1. **** (85% success)
   ```
   select {
case v := <-ch1:
    fmt.Println(v)
case <-time.After(time.Second):
    fmt.Println("timeout")
}
   ```
2. **** (90% success)
   ```
   type Coordinator struct {
    ch chan int
}

func (c *Coordinator) Run() {
    for v := range c.ch {
        go func(v int) {
            // process
        }(v)
    }
}
   ```

## Dead Ends

- **** — Buffering only delays the deadlock; it doesn't break the circular wait. (80% fail)
- **** — Sleeping doesn't guarantee the order; the race condition remains. (90% fail)
