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

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

## Root Cause

A WaitGroup is reused (Add called) while a previous Wait from another goroutine has not yet returned, violating the rule that Add must happen before Wait.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.0+ | active | — | — |

## Workarounds

1. **** (94% success)
   ```
   Use a fresh WaitGroup per batch instead of reusing one:
for _, batch := range batches {
    var wg sync.WaitGroup
    for _, x := range batch { wg.Add(1); go func(x T){ defer wg.Done(); work(x) }(x) }
    wg.Wait()
}
   ```

## Dead Ends

- **** — Timing-based synchronization is nondeterministic and the panic can still occur under load. (85% fail)
