OpenClaw OOM crash loop: gateway or openclaw-message hits JavaScript heap out of memory (Node v24)
Fix OpenClaw gateway or openclaw-message OOM crash loops caused by Node.js v24 by pinning the runtime to Node v22 (LTS) and verifying your service actually uses the expected Node binary.
Symptoms
One of these patterns:
- The gateway enters a crash loop (LaunchAgent/systemd/pm2 keeps restarting it), and you see memory climb rapidly.
openclaw message send ...(oropenclaw-message) fails with an OOM stack trace on smaller servers.
Common crash signatures:
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memoryFATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Cause
In multiple recent reports, the trigger is Node.js v24.x (for example v24.13.0).
The same OpenClaw versions become stable again when the runtime is pinned to Node.js v22.x (LTS).
Fix
1) Pin the runtime to Node.js v22 (recommended)
On the machine that actually runs the gateway (or the CLI command):
node -v
Switch to Node 22 using your preferred manager (nvm/fnm/asdf/apt/homebrew), then confirm:
node -v
Restart and re-test:
openclaw gateway restart
# If your symptom is CLI-only, re-run the exact command that was OOM'ing:
openclaw message send --channel <channel> --target <target> --message "test"
2) Make sure your service uses the same Node you tested
This is the most common “it still OOMs” trap:
- your interactive shell uses Node 22,
- but launchd/systemd/Docker is still running Node 24.
Verify the gateway’s Node version in the service context (the exact method depends on how you run the gateway).
If you are unsure, the pragmatic check is: restart the service and inspect the process environment/path and the resolved Node binary.
3) If you cannot change Node on that host: roll back OpenClaw temporarily
This does not fix the underlying Node runtime trigger, but it can be a short-term stability move while you migrate Node:
npm uninstall -g openclaw
npm install -g openclaw@2026.3.2
openclaw --version
Verify
node -vreports Node 22.x.- The gateway stays up for at least 10 minutes without entering an OOM restart loop.
openclaw gateway status/openclaw healthworks reliably.- If you were hitting the CLI symptom: the previously failing
openclaw message send ...command completes.