Azure Pipelines Out of Memory / Agent Process Killed
A build process exhausted memory on the agent, so the kernel OOM-killed it (often exit code 137) and the job failed.
What this error means
A step fails with an out-of-memory error or is abruptly killed; container jobs frequently show exit code 137. The same heavy step fails under memory pressure.
azure-pipelines
##[error]The operation was canceled.
Container exited with code 137 (Out of memory)Common causes
Undersized agent memory
The agent or container has too little RAM for the workload.
Memory-hungry build
A compile or test step needs more memory than available.
Too many parallel processes
High parallelism in one step exhausts memory.
How to fix it
Increase available memory
- Use a larger agent or raise the container memory limit.
- Cap build-tool heap or parallelism to fit available RAM.
azure-pipelines.yml
steps:
- script: NODE_OPTIONS=--max-old-space-size=4096 npm run buildHow to prevent it
- If you run on GitHub Actions, self-healing managed runners such as Latchkey auto-retry transient failures, so a one-off OOM does not fail the job. On Azure DevOps, right-size agent memory and limit parallelism.
Related guides
Azure Pipelines "No space left on device" on AgentFix the Azure Pipelines "No space left on device" error where the agent ran out of disk during checkout, buil…
Azure Pipelines "ran longer than the maximum time" TimeoutFix the Azure Pipelines timeout where a job ran longer than its maximum time and was canceled, from slow work…
Azure Pipelines "We stopped hearing from agent" Lost CommunicationFix the Azure Pipelines "We stopped hearing from agent" error where the service lost communication with the a…