cicd resource_limits ai_generated true

Container 'build' exceeded memory limit. The step was run with 4096 MB of memory.

ID: cicd/bitbucket-pipeline-oom

Also available as: JSON · Markdown
85%Fix Rate
87%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

Bitbucket Pipelines step exceeded its memory limit and was killed. Common causes include large build artifacts, memory-hungry test suites, or Docker-in-Docker builds consuming excessive memory.

generic

Workarounds

  1. 85% success Use the size: 2x option to double available memory
    In bitbucket-pipelines.yml, add 'size: 2x' to the step definition to double the memory allocation. This uses double the build minutes.
  2. 82% success Optimize the build to reduce memory consumption
    Limit parallel test workers (e.g., --max-workers=2 for Jest). Use --max-old-space-size for Node.js. Split large builds into multiple steps. Use shallow git clone: clone: depth: 1.

Dead Ends

Common approaches that don't work:

  1. Increasing the memory size attribute beyond the plan limit 80% fail

    Bitbucket Pipelines has hard limits per plan tier (e.g., 4GB or 8GB max). Requesting more than the plan allows results in a pipeline configuration error.

  2. Adding swap space inside the container 90% fail

    Bitbucket pipeline containers do not support adding swap. The memory limit is enforced by the container runtime cgroup, which counts both memory and swap.

Error Chain

Leads to:
Preceded by:
Frequently confused with: