# panic: close of closed channel (in goroutine)

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

## Root Cause

Two or more goroutines attempt to close the same channel without synchronization, causing a panic.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Use sync.Once to ensure channel is closed only once.
   ```
2. **** (90% success)
   ```
   Designate a single goroutine to own the channel and close it.
   ```

## Dead Ends

- **** — Recovering doesn't solve the race; it masks the error but may leave other goroutines in inconsistent state. (80% fail)
- **** — Flag check is racy; another goroutine may close it between check and close. (90% fail)
