# Self-Healing CI: Recovering from OOM-Killed Jobs (Exit 137)

> Out-of-memory kills (exit 137) are mechanical, not code bugs. See the manual fix and how self-healing CI automatically recovers OOM-killed jobs.

Source: https://latchkey.dev/learn/self-healing-ci/self-heal-oom-killed-exit-137  
Updated: 2026-06-25

When a build is killed for using too much memory, the failure is about the runner, not your code. That makes it a perfect candidate for automatic recovery.

## What makes a failure safely retryable

Automatic retry is only correct for failures that are genuinely transient. Retrying a deterministic failure wastes minutes and hides a real defect, so the classification matters more than the retry mechanism.

- Safe to retry: network timeouts, registry 5xx, transient DNS failures, a service container that was not ready, a spot instance reclaimed mid-run.
- Not safe to retry: assertion failures, compile errors, lint violations, anything that fails identically on every attempt.
- Ambiguous, and worth investigating rather than retrying: out-of-memory kills, disk exhaustion, and flaky tests. These repeat under load and a retry only hides the trend.
- Always record that a retry happened. A pipeline that silently retries is a pipeline whose real failure rate you do not know.

## FAQ

### Isn’t automatically retrying an OOM just hiding a real problem?

Only if the memory growth is a genuine leak in your code. Most CI OOMs are mechanical - a build that legitimately needs a bit more headroom than the default runner provides. Self-healing handles the mechanical case automatically and surfaces the genuine-bug case instead of silently masking it.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
