# panic: sync: negative WaitGroup counter

- **ID:** `go/waitgroup-add-positive-delta`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

wg.Done() is called more times than wg.Add(). Usually a missing Add before launching a goroutine, a double defer wg.Done(), or Done called in a loop path that runs more than the added count.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.18 | active | — | — |
| 1.20 | active | — | — |
| 1.22 | active | — | — |

## Workarounds

1. **** (96% success)
   ```
   wg.Add(1)
go func() {
    defer wg.Done()
    work()
}()
   ```
2. **** (90% success)
   ```
   func launch(wg *sync.WaitGroup, f func()) {
    wg.Add(1)
    go func() { defer wg.Done(); f() }()
}
   ```

## Dead Ends

- **** — Masks the real double-Done bug and can cause Wait to hang forever if the count never reaches zero. (70% fail)
- **** — Wait then blocks forever because the counter never decrements. (90% fail)
