# panic: sync: WaitGroup is reused before previous Wait has returned

- **ID:** `go/waitgroup-reused-before-wait`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Calling wg.Add() again while a previous wg.Wait() is still in progress. The runtime detects the concurrent reuse.

## Version Compatibility

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

## Workarounds

1. **** (94% success)
   ```
   var wg sync.WaitGroup
wg.Add(len(items))
for _, it := range items { go func(i int){ defer wg.Done(); process(i) }(it) }
wg.Wait()
   ```
2. **** (88% success)
   ```
   done := make(chan struct{})
go func(){ wg.Wait(); close(done) }()
<-done
// safe to reuse
   ```

## Dead Ends

- **** — Timing-dependent; under load the Wait may still be in progress. (85% fail)
- **** — Couples unrelated batches and can deadlock when one batch never completes. (60% fail)
