GitLab CI "exit code 137": the job ran out of memory, and how to fix it
Short answer
Exit code 137 means the job's process was killed with SIGKILL, 128 plus signal 9, and in CI that's usually for running out of memory. On the Kubernetes executor the log usually says reason: 'OOMKilled'. GitLab.com's default small Linux runner has 8 GB; tag the job saas-linux-medium-amd64 for 16 GB, or use a larger runner on Premium and Ultimate. On your own runners, raise memory in config.toml: memory for the Docker executor, memory_limit for Kubernetes, where a job can raise its own limit with KUBERNETES_MEMORY_LIMIT if the runner allows it. Or make the job use less, with explicit heap sizes and fewer parallel workers.
A build or test job stops partway through:
ERROR: Job failed: exit code 137
On the Kubernetes executor, the log usually names the cause:
ERROR: Job failed (system failure): Error in container build: exit code: 137, reason: 'OOMKilled'
137 is 128 plus 9: the process was killed with SIGKILL. In CI that usually means it ran out of memory, and the kernel or the container’s memory limit stopped it. Here’s how to find the limit you hit and raise it, or use less.
Check it’s memory
-
The log says
OOMKilled: it’s memory. -
Kubernetes says
command terminated with exit code 137, withoutOOMKilled: a process inside the container was killed, or the pod’s node went away, for example when the cluster scaled down, evicted the pod or lost a spot instance. -
The Docker executor says only
exit code 137: print the container’s memory limit, current use and peak around the heavy step.maxmeans no limit, as on GitLab.com’s hosted runners, where the job has the whole machine:script: - cat /sys/fs/cgroup/memory.max /sys/fs/cgroup/memory.current || true - npm run build - cat /sys/fs/cgroup/memory.peak || true -
The usual suspects are bundlers such as webpack and Vite, TypeScript type checks, test runners with many workers, Gradle and Maven builds, and Docker builds, especially when several run at once.
On GitLab.com
Each job runs on its own hosted runner. The default is small:
| Runner tag | vCPUs | Memory | Plans |
|---|---|---|---|
saas-linux-small-amd64 (default) |
2 | 8 GB | All |
saas-linux-medium-amd64 |
4 | 16 GB | All |
saas-linux-large-amd64 |
8 | 32 GB | Premium, Ultimate |
saas-linux-xlarge-amd64 |
16 | 64 GB | Premium, Ultimate |
saas-linux-2xlarge-amd64 |
32 | 128 GB | Premium, Ultimate |
Pick one with tags:
build:
tags:
- saas-linux-medium-amd64
script:
- npm run build
Bigger runners use compute minutes faster: a medium runner counts double. See GitLab compute minutes.
On your own runners
-
Docker executor:
memoryin the runner’s[runners.docker]section caps each job’s container, such asmemory = "4g";service_memorycaps services. Raise or remove the cap, and check that the host has memory for every job that runs at once, set byconcurrent. -
Kubernetes executor:
memory_limitandmemory_requestin[runners.kubernetes]set the build container’s memory. To let jobs ask for more, setmemory_limit_overwrite_max_allowed, andmemory_request_overwrite_max_allowedfor the request; a job can then set its own values up to those maximums:build: variables: KUBERNETES_MEMORY_REQUEST: "2Gi" KUBERNETES_MEMORY_LIMIT: "4Gi"Without a maximum set, a variable is ignored; above it, the job fails. Services and the helper container have their own settings, such as
KUBERNETES_SERVICE_MEMORY_LIMIT.
Make the job use less
- Cap runtime heaps below the limit, so a build fails with a clear message instead of a kill:
NODE_OPTIONS: "--max-old-space-size=3072"for Node.js,-Xmxfor Java,org.gradle.jvmargsfor Gradle. - Set worker counts yourself. In a container, tools often see the host’s CPUs and start too many workers: use
--maxWorkers=2in Jest,make -j2, and similar options. - Split the job. For tests,
parallel: 4runs four copies withCI_NODE_INDEXandCI_NODE_TOTALset, which tools such asjest --shardcan use, so each part needs less memory. - Watch the services. A database service shares the runner’s memory with the job on GitLab.com’s hosted runners.
A retry only helps when memory use varies between runs. exit_codes needs a max, and it can’t see the Kubernetes OOMKilled failure, which is a runner system failure:
retry:
max: 2
exit_codes: 137
when: runner_system_failure
On your phone
MergeBell shows a job’s log live, so the exit code 137 line is there when the runner writes it, and Retry reruns the job on the free tier. A retry runs on the same kind of runner, so a new runner tag or memory setting in .gitlab-ci.yml needs a new commit. More in how to retry a failed GitLab pipeline.
Frequently asked questions
What does "exit code 137" mean in GitLab CI?
The job's process was killed with SIGKILL: 137 is 128 plus signal 9. In CI that's usually the out-of-memory killer or a container memory limit stopping a process that used too much. On the Kubernetes executor, the log usually says so with reason: 'OOMKilled'; without it, the pod's node may have been scaled down or the pod evicted.
How much memory do GitLab.com runners have?
The default saas-linux-small-amd64 runner has 2 vCPUs and 8 GB of memory, and saas-linux-medium-amd64 has 4 vCPUs and 16 GB on every plan. Premium and Ultimate can use large with 32 GB, xlarge with 64 GB and 2xlarge with 128 GB. Pick one with tags in the job; bigger runners use compute minutes faster.
How do I give a GitLab job more memory on Kubernetes?
Raise memory_limit, and memory_request, in the runner's [runners.kubernetes] section. To let jobs choose, set memory_limit_overwrite_max_allowed, and memory_request_overwrite_max_allowed for requests; a job can then set KUBERNETES_MEMORY_LIMIT, such as 4Gi, up to that maximum. Services and the helper container have their own settings and variables.
How do I give a GitLab job more memory with the Docker executor?
The memory setting in the runner's [runners.docker] section caps each job's container; raise it or remove it, and check that the host has the memory for all concurrent jobs. Services have their own limit, service_memory.
Should I retry GitLab jobs that fail with exit code 137?
Only if memory use varies between runs. retry:exit_codes, generally available since GitLab 17.5, retries just those failures, but it needs retry:max, and on Kubernetes an OOMKilled container counts as a runner system failure, so add when: runner_system_failure. If the job always needs more memory than the runner has, give it a bigger runner or make it use less.
Sources
- GitLab docs — Hosted runners on Linux (machine types)
- GitLab Runner docs — Docker executor settings (memory)
- GitLab Runner docs — Kubernetes executor: overwrite container resources
- GitLab docs — retry:exit_codes
- GitLab Runner source — the OOMKilled message (kubernetes.go)
Checked against these pages on 8 November 2026. GitLab changes quickly — if something here no longer matches, tell us and we will fix it.
Do this from your phone with MergeBell
Free for the whole review loop: the To-Do inbox, diffs and line comments, approve and merge, pipelines with retry, and push alerts for your To-Dos. Works with gitlab.com and self-managed GitLab 16.0+.
Get MergeBell for iPhoneGet MergeBell for Android
On the App Store for iOS 26 or later and on Google Play for Android 12 or later. An independent app, not affiliated with GitLab Inc.