# panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x...] (in goroutine N)

- **ID:** `go/goroutine-nil-pointer-in-goroutine`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A goroutine dereferences a nil pointer, often because it captured a variable that was not yet assigned or a struct field was left uninitialized.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   for _, item := range items {
    item := item
    go func(it *Item) {
        process(it)
    }(&item)
}
   ```
2. **** (92% success)
   ```
   svc := &Service{Client: newClient()}
go svc.Run()
   ```

## Dead Ends

- **** — If the nil is a logic error (e.g., missing initialization), skipping the work silently hides the bug. (60% fail)
- **** — Recovering prevents a crash but does not fix the root cause; the same nil deref will recur. (80% fail)
