Exit Code 137 (Out of Memory) on GitLab CI - Causes and Fixes
Exit Code 137 (Out of Memory) is an infrastructure failure, not a bug in your code - here is the GitLab CI-specific fix.
What this error means
A step or job ends with exit code 137 and often just the word Killed. The process received SIGKILL - on CI runners, almost always the out-of-memory killer.
Killed
Process completed with exit code 137.Common causes
The job exceeded the available memory
Bundlers, compilers, and test suites can spike past the runner memory ceiling; the kernel OOM killer terminates the heaviest process with SIGKILL.
A container/heap limit is too low
An explicit memory limit (or a too-small language heap) makes the process hit the wall sooner.
How to fix it
Give it more resources on GitLab CI
Run the job on a runner with more resources - tag a larger runner, or for the Kubernetes executor set KUBERNETES_MEMORY_REQUEST / KUBERNETES_MEMORY_LIMIT.
Reduce peak usage
Lower build/test parallelism and cap language heaps (e.g. NODE_OPTIONS=--max-old-space-size) below the runner limit.
How to prevent it
- Right-size GitLab CI runners/agents for the job.
- Cache dependencies to cut time, memory pressure, and network calls.
- Use self-healing runners that retry transient and mechanical failures automatically.