OpenClaw Gateway "Maximum Call Stack Size Exceeded"? Here Is the Fix
The RangeError: Maximum call stack size exceeded crash in the OpenClaw Gateway has three known causes: a config recursion bug around disabled plugins, version-specific schema compilation bugs, and oversized session payloads. This guide walks through each fix with exact commands.
You start the OpenClaw Gateway, or send a message through the Control UI, and instead of an agent reply you get a wall of red text ending in RangeError: Maximum call stack size exceeded. Sometimes the gateway crashes on boot, sometimes every plugin fails to load, and sometimes a single message silently disappears. The error looks scary, but it maps to a short list of known causes, and all of them are fixable without reinstalling from scratch.
RangeError: Maximum call stack size exceeded
This is a Node.js (V8) error, not an OpenClaw-specific one. It means a function kept calling itself, or a chain of functions kept calling each other, until the JavaScript call stack ran out of room. It is a recursion problem, not a memory or RAM problem. In OpenClaw, three triggers account for nearly every report:
- Config recursion: a plugin listed in
plugins.entrieswithenabled: falsethat is also missing fromplugins.allowmakes the gateway emit a config warning, which reloads the config, which emits the warning again, forever. - Version-specific bugs: certain releases shipped schema compilation bugs that overflow the stack while loading plugins or building validators. The v2026.4.5 release, for example, broke plugin loading on Windows with Node 24.
- Oversized session payloads: sending a large image attachment (roughly 4 MB and up) through the Control UI webchat, or sending anything when a session is near its context limit, can crash the send path with the same error.
Match your symptom to the trigger: crash on gateway start or plugin load points to causes 1 or 2; crash when sending a specific message points to cause 3.
Fix 1: Update to the Latest Stable Release (or Pin a Known-Good One)
Because several of these crashes were straight-up bugs, the first move is always to get off the affected build.
- Check what you are running:
openclaw --version. - Update through the built-in updater:
openclaw update --channel stable. If you installed via npm, you can also runnpm install -g openclaw@latest. - If the latest release is itself the broken one (this happened with v2026.4.5, where a schema library bug crashed all plugin loading), pin the previous stable instead:
npm install -g openclaw@2026.4.2or whichever version last worked for you. - Restart the gateway:
openclaw gateway restart, then confirm withopenclaw gateway status.
One caution: on the affected builds, openclaw doctor --fix can hit the exact same stack overflow while probing plugins, so automated repair fails too. Update the binary first, then run doctor.
Fix 2: Remove the Disabled-Plugin Config Recursion Trap
If the gateway crashes on startup and your logs show a config warning repeating right before the RangeError, you are almost certainly hitting the infinite recursion bug around disabled plugins.
- Find your config file:
openclaw config fileprints the active path (default is~/.openclaw/openclaw.json). - Open it in any editor and look at the
pluginssection. - Find any entry in
plugins.entriesthat hasenabled: falsebut does not appear in theplugins.allowlist. - Either delete that entry entirely (if you no longer use the plugin) or add its id to
plugins.allowso the warning never fires. - Validate the result:
openclaw config validate. - Restart:
openclaw gateway restart.
This bug was reported on 2026.3.28 builds, but the safe pattern is worth keeping regardless: do not leave half-removed plugin entries sitting in the config.
Fix 3: Reset the Session That Triggers the Crash
If the gateway itself runs fine but a specific message blows up, the problem is the payload or the session state, not the install.
- Start a fresh session instead of retrying in the crashed one. In chat, send
/newto reset the conversation context. - If the crash happened while sending an image, resize or compress it first. Reports show PNG and JPEG attachments around 4 MB reliably trigger the error in the webchat, while smaller files go through.
- If a long-running session was near its context limit, compact it or start over rather than pushing one more large message into it.
- Retry the message in the fresh session and watch
openclaw logs --followto confirm it goes through cleanly.
Per-OS Notes
Windows
The v2026.4.5 plugin-loading crash was reported on Windows 11 with Node 24.x, so Windows users saw this error most often. Roll forward to the current stable or pin v2026.4.2. Run openclaw gateway run in a terminal (instead of the background service) to see the full stack trace while you test.
macOS
The config recursion bug was first reported on macOS arm64 beta builds. If you run the dev or beta channel on a Mac, check the plugins section of your config before anything else, and consider switching back with openclaw update --channel stable.
Linux and VPS
The same fixes apply. Also confirm your Node version meets the requirement (Node 22.19+, 23.11+, or 24+), since mixing an old system Node with a new OpenClaw build produces strange loader behavior. node --version tells you in one second.
Frequently Asked Questions
Is "Maximum call stack size exceeded" a memory problem?
No. It is a recursion problem: code calling itself until the call stack overflows. Adding RAM or raising Node's heap size will not help. The fix is always to break the recursion, which in OpenClaw's case means updating past the buggy release, fixing the plugin config entry, or shrinking the payload that triggers it.
Will deleting the .openclaw folder fix the error?
It usually will, but it is the nuclear option: you lose your config, sessions, and pairing state. Try the targeted fixes first. If you do reset, back up ~/.openclaw/openclaw.json before deleting anything so you can restore your settings selectively.
Which OpenClaw versions are affected by this bug?
It is not one bug but a family. Known offenders include 2026.3.28 beta builds (config warning recursion) and v2026.4.5 (plugin loading crash with Node 24). The pattern to remember: check the GitHub issues for your exact version, and treat the latest stable release as the default fix.
If you would rather not track which OpenClaw release is safe this week, a managed OpenClaw host applies vetted updates and keeps a valid config for you.
Frequently asked questions
- Is "Maximum call stack size exceeded" a memory problem?
- No. It is a recursion problem: code calling itself until the call stack overflows. Adding RAM or raising Node's heap size will not help. The fix is always to break the recursion, which in OpenClaw's case means updating past the buggy release, fixing the plugin config entry, or shrinking the payload that triggers it.
- Will deleting the .openclaw folder fix the error?
- It usually will, but it is the nuclear option: you lose your config, sessions, and pairing state. Try the targeted fixes first. If you do reset, back up ~/.openclaw/openclaw.json before deleting anything so you can restore your settings selectively.
- Which OpenClaw versions are affected by this bug?
- It is not one bug but a family. Known offenders include 2026.3.28 beta builds (config warning recursion) and v2026.4.5 (plugin loading crash with Node 24). The pattern to remember: check the GitHub issues for your exact version, and treat the latest stable release as the default fix.
Related guides
- OpenClaw Stuck on Starting (or the Control Panel Will Not Open)When OpenClaw hangs on startup it is almost always a port conflict, a broken config file, the wrong Node version, or a service manager hiding an interactive prompt. When the gateway runs but the control panel will not open, an expired dashboard token or a blocked port is the usual cause. This guide covers every fix with exact commands.
- Where Is the OpenClaw Config File?OpenClaw keeps its configuration in a single JSON5 file at ~/.openclaw/openclaw.json on every OS. This guide shows how to find the active file, edit it without breaking the gateway, regenerate it from scratch, and which fields not to touch.
- Fixing "API rate limit reached, please try again" in OpenClawThis error means your model provider returned a 429, not that OpenClaw is broken. Learn what the limit means on Anthropic, OpenAI, and Groq, how OpenClaw's cooldown and fallback logic behaves, and how to configure fallbacks so one throttled key never stops your agent.
- Stop Your Mac Mini Sleeping So OpenClaw Stays OnlineA sleeping Mac mini takes your OpenClaw agent offline, killing heartbeats, cron jobs, and channel connections. Fix it permanently with pmset, caffeinate, Energy settings, or Amphetamine, and make sure the Gateway comes back on its own after reboots.
