OpenClaw Offline? Common Fixes
Troubleshooting guide for when OpenClaw (formerly Moltbot) goes offline. Diagnose and fix connection issues, crashes, and configuration problems.
Quick Diagnosis
When OpenClaw goes offline, check these first:
# Is the process running?
pm2 status
# View recent logs
pm2 logs openclaw --lines 50
# Check system resources
free -h && df -h
Common Causes & Fixes
1. Process Crashed
Symptoms: Bot shows offline everywhere
Check:
pm2 status
# Look for "errored" or "stopped" status
Fix:
pm2 restart openclaw
Prevent future crashes:
pm2 start openclaw --max-memory-restart 500M --restart-delay 5000
2. Invalid API Token
Symptoms: Bot starts but immediately goes offline
Check logs:
pm2 logs openclaw | grep -i "token\|auth\|401"
Fix:
For Discord:
- Regenerate token at Discord Developer Portal
- Update
.env:
nano /opt/openclaw/.env
# Update DISCORD_TOKEN
- Restart:
pm2 restart openclaw
For Telegram:
- Regenerate with @BotFather
/revoke - Update
.envwith new token - Restart
3. API Key Expired/Invalid
Symptoms: Bot online but doesn't respond to messages
Check:
pm2 logs openclaw | grep -i "api\|anthropic\|openai\|key"
Fix:
- Verify API key at provider's console
- Check for billing issues
- Update
.envwith valid key - Restart:
pm2 restart openclaw
4. Memory Exhaustion
Symptoms: Bot becomes slow then crashes
Check:
pm2 monit
# Watch memory climb
Quick fix:
pm2 restart openclaw
Long-term fix:
# Increase memory limit
pm2 delete openclaw
pm2 start index.js --name openclaw \
--node-args="--max-old-space-size=2048" \
--max-memory-restart 1G
pm2 save
5. Network Issues
Symptoms: Intermittent offline, timeout errors
Check:
ping discord.com
ping api.anthropic.com
curl -I https://discord.com/api/v10/gateway
Fix:
- Check VPS provider status page
- Verify firewall:
sudo ufw status - Check DNS:
nslookup discord.com - Wait for provider to resolve (if their issue)
6. Discord Gateway Disconnect
Symptoms: "Gateway disconnected" in logs
Check:
pm2 logs openclaw | grep -i "gateway\|disconnect\|shard"
Fix:
pm2 restart openclaw
If persistent, check intents:
- Go to Discord Developer Portal
- Enable required intents:
- Presence Intent
- Server Members Intent
- Message Content Intent
7. Telegram Polling Timeout
Symptoms: Telegram bot offline, "polling error" in logs
Check:
pm2 logs openclaw | grep -i "telegram\|polling\|getUpdates"
Fix:
# Sometimes webhook conflicts exist
# Clear any existing webhook
curl "https://api.telegram.org/bot<TOKEN>/deleteWebhook"
pm2 restart openclaw
8. Configuration Error
Symptoms: Bot won't start, config errors in logs
Check:
pm2 logs openclaw | grep -i "config\|env\|parse\|json"
Fix:
# Test running directly
cd /opt/openclaw
node index.js
# Check for syntax errors
node --check index.js
# Verify .env file
cat .env | head -20
Diagnostic Script
Run this comprehensive check:
#!/bin/bash
echo "=== OpenClaw Diagnostic ==="
echo ""
echo "Process Status:"
pm2 status openclaw
echo ""
echo "Memory:"
free -h
echo ""
echo "Disk:"
df -h /
echo ""
echo "Recent Errors:"
pm2 logs openclaw --err --lines 20
echo ""
echo "Network Test:"
ping -c 2 discord.com
Save as diagnose.sh, run with bash diagnose.sh.
Log Analysis
Common Error Messages
| Error | Meaning | Solution |
|-------|---------|----------|
| ECONNREFUSED | Can't reach server | Check network/firewall |
| 401 Unauthorized | Invalid token | Update credentials |
| 429 Too Many Requests | Rate limited | Wait/reduce frequency |
| ENOMEM | Out of memory | Restart/increase RAM |
| ETIMEDOUT | Request timeout | Check connectivity |
| TOKEN_INVALID | Revoked/wrong token | Regenerate token |
Reading Stack Traces
# Get detailed error info
pm2 logs openclaw --err --lines 100
# Look for:
# - Error name (TypeError, ReferenceError, etc.)
# - File and line number
# - Stack trace showing call path
Prevention Checklist
- [ ] Auto-restart enabled:
pm2 start --restart-delay 5000 - [ ] Memory limit set:
--max-memory-restart 500M - [ ] Logs rotated:
pm2 install pm2-logrotate - [ ] Monitoring active: See monitoring guide
- [ ] Backups configured
- [ ] Alert webhook set up
Recovery Steps
If nothing else works:
# 1. Stop everything
pm2 delete openclaw
# 2. Clean install
cd /opt/openclaw
rm -rf node_modules
npm install
# 3. Verify config
cat .env # Check all values
# 4. Test manually
node index.js
# 5. If working, restart with PM2
pm2 start index.js --name openclaw
pm2 save
pm2 startup
Related Guides
Still Offline?
If you've tried everything, contact us for help. Our maintenance plans include monitoring and rapid response to outages.
Need a VPS for Your Bot?
We recommend Hostinger KVM 2 VPS - reliable, fast, and perfect for AI chatbots. Get started with our recommended setup.
Get Hostinger VPSNeed Help With Setup?
Got your VPS? Let us handle the technical work. Professional setup and maintenance for OpenClaw (formerly Clawd.bot).