# panic: close of closed channel

- **ID:** `go/close-channel-multiple-times`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Attempting to close a channel that has already been closed, often due to concurrent close calls without synchronization.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   var closeOnce sync.Once; closeOnce.Do(func() { close(ch) })
   ```
2. **** (90% success)
   ```
   var closed bool; if !closed { close(ch); closed = true }
   ```

## Dead Ends

- **** — Recover only prevents crash but doesn't fix the logic; can mask bugs. (60% fail)
- **** — Defer executes on function exit; if close happens earlier, panic occurs. (80% fail)
