# exec: command timed out

- **ID:** `go/os-exec-command-timeout`
- **Domain:** go
- **Category:** system_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

An external command executed with exec.CommandContext exceeds the context deadline, causing the process to be killed.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second); defer cancel(); cmd := exec.CommandContext(ctx, "sleep", "30"); if err := cmd.Run(); err != nil { ... }
   ```

## Dead Ends

- **** — May hang indefinitely, consuming resources. (80% fail)
- **** — Doesn't solve the root cause; may still timeout for long-running commands. (60% fail)
