← Back to blog
Troubleshooting March 2026

OpenClaw Bot Keeps Crashing? Here's Why

You notice your Telegram bot went silent. You check — the OpenClaw gateway is down again. You restart it. It comes back up. Forty minutes later, down again. Sound familiar? This is a crash loop, and it has specific causes. Here's how to diagnose and fix each one.

First: What Does "Crashing" Actually Mean?

OpenClaw bots crash in two different ways, and they have different causes:

Symptom Likely cause How to tell
Bot stops responding but process still running Telegram connection dropped / token invalid openclaw status shows "running" but bot doesn't reply
Gateway process exits and restarts Unhandled exception, config error, or resource exhaustion Logs show repeated "starting" messages
Gateway exits and doesn't restart Config file corrupted, missing env var, port conflict Service stays stopped until you manually restart

Run this first to see what's actually happening:

Terminal — Mac
log stream --predicate 'subsystem == "io.openclaw"' --last 1h | tail -50
Terminal — Linux
sudo journalctl -u openclaw-gateway -n 100 --no-pager

Cause 1: Memory Leak — The Slow Killer

Most Common — Accounts for ~40% of crash loops
Node.js process grows in memory until the OS kills it

OpenClaw runs a Node.js process. Some AI provider SDKs and plugin code have memory leaks — small objects that accumulate over hours. After 8-16 hours, memory exceeds available RAM and the OS terminates the process.

How to confirm
Terminal
# Check process memory right now
ps aux | grep openclaw | grep -v grep

# Check if system is low on memory
free -h    # Linux
vm_stat   # Mac
Fix: Set a memory limit + auto-restart
~/.openclaw/workspace or your gateway config
# Add to your gateway startup args (or systemd ExecStart)
node --max-old-space-size=512 ...

# Or: configure max memory in openclaw config
# openclaw.json → "gateway.maxMemoryMb": 512
Permanent fix: Mechanic's self-health monitor detects memory trends. If RSS grows >50MB over 10 samples, it flags a possible leak and alerts you before the crash — not after.

Cause 2: Config File Corruption

Second Most Common — Appears after system crashes or dirty shutdowns
openclaw.json has invalid JSON or missing required fields

If your Mac shut down ungracefully (power cut, force-restart) while OpenClaw was writing config, the config file can be truncated. On the next startup, the gateway fails to parse it and exits immediately.

How to spot it
Terminal
# Check if config is valid JSON
cat ~/.openclaw/workspace/openclaw.json | python3 -m json.tool

# Or check logs for parse errors
grep -i "config\|parse\|json" /tmp/openclaw*.log 2>/dev/null || \
  sudo journalctl -u openclaw-gateway | grep -i "config\|parse\|json"
Fix: Restore from backup or rebuild config
Terminal
# Check for automatic backup
ls ~/.openclaw/workspace/openclaw.json.bak*

# Restore if backup exists
cp ~/.openclaw/workspace/openclaw.json.bak ~/.openclaw/workspace/openclaw.json

# Re-run gateway setup if no backup
openclaw gateway setup
Warning: If you rebuild config from scratch, your Telegram bot token is gone. Make sure you have it written down before attempting a fresh setup — it cannot be recovered from OpenClaw, only from the BotFather in Telegram.

Cause 3: Telegram Token Invalid or Revoked

Common — Also causes "running but silent" symptom
Bot connects but Telegram rejects the token

If you regenerated your token in BotFather, or if Telegram revoked it (unusual), OpenClaw starts successfully but cannot connect to Telegram. The process keeps running but your bot is silent. Some versions exit and restart repeatedly.

How to confirm
Terminal
# Look for Telegram auth errors in logs
grep -i "telegram\|token\|401\|unauthorized" ~/.openclaw/workspace/logs/*.log 2>/dev/null | tail -20

# Quick test: check the token manually
curl "https://api.telegram.org/bot<YOUR_TOKEN>/getMe"
Fix: Update the bot token
Terminal
# Edit config and replace the token
nano ~/.openclaw/workspace/openclaw.json
# → Find "botToken" under channels.telegram
# → Replace with new token from BotFather

# Then restart
openclaw gateway restart

Cause 4: Node.js Version Mismatch

Common After System Updates
OpenClaw was built for a different Node.js version

macOS updates and Homebrew upgrades can silently change your Node.js version. If native modules (node-pty, better-sqlite3) were compiled for Node 18 and you're now running Node 22, they crash immediately with a binding error.

How to check
Terminal
node --version
# Should show the same version OpenClaw was installed with

# Check for binding errors in logs
grep -i "binding\|NODE_MODULE_VERSION\|was compiled against" ~/.openclaw/workspace/logs/*.log 2>/dev/null | tail -5
Fix: Rebuild native modules
Terminal (in your OpenClaw directory)
cd ~/.openclaw

# Rebuild all native modules for current Node version
npm rebuild

# If that fails, reinstall from scratch
npm install

# Then restart
openclaw gateway restart

Cause 5: Port Already in Use

Common on Shared Dev Machines
Another process is using OpenClaw's port

OpenClaw needs a specific port to run. If another process claims it first (another OpenClaw instance, a dev server, Docker container), the gateway exits immediately with EADDRINUSE.

How to check
Terminal
# Find what's using OpenClaw's default port
lsof -i :4999 2>/dev/null || ss -tlnp | grep 4999

# Check logs for the specific error
grep -i "EADDRINUSE\|address in use\|port" ~/.openclaw/workspace/logs/*.log 2>/dev/null | tail -5
Fix: Kill the conflicting process or change port
Terminal
# Kill the process on the port (replace PID from lsof output)
kill -9 <PID>

# Or change OpenClaw's port in config:
# openclaw.json → "gateway.port": 5001

# Restart
openclaw gateway restart

Cause 6: Disk Full

Less Common — But When It Hits, Nothing Helps Until Disk Is Free
Node.js cannot write temp files, SQLite cannot write to disk

OpenClaw and its dependencies need to write temp files, logs, and database records. When disk is full, any write fails and the process crashes. On VPS with small root partitions, this can fill up fast.

Check disk usage
Terminal
df -h /
du -sh ~/.openclaw/workspace/logs/ 2>/dev/null
du -sh /var/log/ 2>/dev/null  # Linux
Free up space
Terminal
# Clear npm cache
npm cache clean --force

# Clear old logs
journalctl --vacuum-size=200M  # Linux
find ~/.openclaw/workspace/logs -mtime +7 -delete

# Clear /tmp
sudo rm -rf /tmp/*

Quick Diagnostic Checklist

Run this in order. Stop at the first thing that shows a problem:

Terminal — Full diagnostic
# 1. Check if process is running at all
pgrep -fl openclaw

# 2. Check recent logs for errors
sudo journalctl -u openclaw-gateway -n 50 --no-pager 2>/dev/null || \
  tail -50 ~/.openclaw/workspace/logs/*.log 2>/dev/null

# 3. Check config is valid JSON
node -e "require('fs').readFileSync(process.env.HOME+'/.openclaw/workspace/openclaw.json','utf8')" && echo "config OK" || echo "CONFIG BROKEN"

# 4. Check disk
df -h / | tail -1

# 5. Check memory
free -h 2>/dev/null || vm_stat | grep Pages

# 6. Check Node version
node --version

# 7. Try a clean restart and watch for errors
openclaw gateway stop && openclaw gateway start 2>&1 | head -20

If None of These Fix It

If you've gone through all six causes and your bot is still crashing, there's likely something environment-specific going on — a plugin, a specific config combination, or a system state issue that doesn't fit the standard patterns.

At this point, the most efficient path is a fresh repair session where you can see live logs while you try fixes. Mechanic automates this: it collects diagnostics, tries the most likely strategy first, and escalates to a live terminal session if needed.

Stop diagnosing crashes manually
Mechanic Bot monitors your OpenClaw gateway 24/7 and auto-repairs the causes above — without you having to SSH in at 2am. When it can't fix it automatically, it opens a repair session and alerts you.
See plans →