# panic: runtime error: send on nil channel

- **ID:** `go/nil-channel-send`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Attempting to send on a channel that is nil (not initialized with make)

## Version Compatibility

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

## Workarounds

1. **Initialize channel with make before any send operation** (95% success)
   ```
   ch := make(chan int, 10)
ch <- 42
   ```
2. **Use sync.Once to ensure channel initialization is done once** (90% success)
   ```
   var once sync.Once
var ch chan int
once.Do(func() {
    ch = make(chan int)
})
ch <- 42
   ```

## Dead Ends

- **Using a global variable without initialization** — Global channel variables default to nil; forgetting to initialize with make leads to panic (90% fail)
- **Assuming channel is initialized after function returns** — If the channel is assigned inside a goroutine, it may still be nil when another goroutine tries to send (80% fail)
