Critical · Memory & OOM

How to Fix Exit Code 137 (SIGKILL / OOMKilled)

TL;DR Fix

Linux kernel OOM killer terminated n8n or OpenClaw because container RSS exceeded host RAM with no swap cushion. Use at least 4 GB RAM ($47.98/yr RackNerd BF) or 8 GB RAM (Hostinger KVM 2) + 2 GB swap.

Exact Error Signature

container exited with code 137 | dmesg: Out of memory: Killed process (node)

Copy-Paste Fix Commands

sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# Add to docker-compose.yml environment:
# NODE_OPTIONS=--max-old-space-size=2048

Deep Diagnostic Checklist for Exit Code 137 (OOMKilled)

Before upgrading RAM blindly, confirm whether the Linux kernel OOM killer or a tight Docker container cap killed your Node.js worker:

# 1. Confirm Linux kernel OOM kill timestamp
dmesg -T | grep -i -E "oom|killed process" | tail -n 10

# 2. Check if Docker memory cap was hit (returns true if OOMKilled)
docker inspect --format='{{.State.OOMKilled}} | Exit={{.State.ExitCode}}' $(docker compose ps -q n8n)

# 3. Prevent binary payloads (PDF/audio/images) from eating Node RAM in .env:
N8N_DEFAULT_BINARY_DATA_MODE=filesystem
EXECUTIONS_DATA_PRUNE=true
EXECUTIONS_DATA_MAX_AGE=168
EXECUTIONS_DATA_PRUNE_MAX_COUNT=25000

Preventing Recurrence

Use at least 4 GB RAM ($47.98/yr RackNerd BF) or 8 GB RAM (Hostinger KVM 2) + 2 GB swap.

Verify Memory Headroom or Generate a Pre-Hardened Compose Stack

More Production Error Fixes