# fatal error: all goroutines are asleep - deadlock! (sync.Once.Do calling itself)

- **ID:** `go/sync-once-deadlock-recursive`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A sync.Once.Do function calls the same Once.Do again (directly or indirectly), blocking on its own mutex forever.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Ensure the function passed to Do never calls the same Once; extract shared init into a separate helper
   ```
2. **** (88% success)
   ```
   Use sync.OnceFunc/OnceValue (Go 1.21+) and keep init logic non-reentrant
   ```

## Dead Ends

- **** — Once holds an internal mutex with no timeout support; deadlock persists (90% fail)
- **** — Loses thread-safety; introduces data races (80% fail)
