OpenClaw Common Errors and How to Fix Them
Comprehensive guide to diagnosing and fixing common OpenClaw errors including installation issues, API errors, channel problems, and performance issues.
OpenClaw Manuals
Tutorial Authors
Quick Diagnostics
Before diving into specific errors, run these diagnostics:
# Check overall status openclaw status # Verify configuration openclaw config validate # Check logs for recent errors openclaw logs --tail 50 --level error # Run health check openclaw doctor
Installation Errors
Error: "Node.js version too old"
Error: OpenClaw requires Node.js >= 22.0.0 Current version: 18.17.0
Fix:
# Using nvm (recommended) nvm install 22 nvm use 22 nvm alias default 22 # Or using Homebrew (macOS) brew install node@22 # Verify node --version # Should show v22.x.x
Error: "EACCES permission denied"
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
Fix: Don't use sudo. Instead, fix npm permissions:
# Option 1: Use nvm (recommended) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash # Option 2: Change npm's default directory mkdir ~/.npm-global npm config set prefix '~/.npm-global' echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc source ~/.bashrc # Then reinstall npm install -g openclaw@latest
Error: "Cannot find module"
Error: Cannot find module '@openclaw/core'
Fix:
# Clear npm cache and reinstall npm cache clean --force npm uninstall -g openclaw npm install -g openclaw@latest # Or use the installer script curl -fsSL https://openclaw.ai/install.sh | bash
Error: "gyp ERR! build error" (Native modules)
gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2
Fix: Install build tools:
# macOS xcode-select --install # Ubuntu/Debian sudo apt install build-essential python3 # Windows npm install -g windows-build-tools
API and Authentication Errors
Error: "401 Unauthorized"
Error: API request failed with status 401: Invalid API key
Fix:
# Verify your API key is set openclaw config get api-key # If empty or wrong, set it again openclaw config set api-key # Check the key format (Anthropic keys start with sk-ant-) # Make sure there are no extra spaces or quotes
Error: "429 Rate Limited"
Error: Rate limit exceeded. Please retry after 60 seconds.
Fix:
// ~/.openclaw/openclaw.json
{
"model": {
"rateLimiting": {
"retryOnRateLimit": true,
"maxRetries": 3,
"retryDelay": 5000,
"maxRequestsPerMinute": 30
}
}
}
For persistent rate limiting, consider upgrading your API tier or using a different model:
openclaw config set default-model claude-3-5-haiku
Error: "402 Payment Required"
Error: API request failed: Insufficient credits
Fix:
- Check your API provider balance
- Add credits to your account
- Or set up usage limits:
// ~/.openclaw/openclaw.json
{
"model": {
"quotas": {
"daily": {
"enabled": true,
"maxTokens": 100000,
"warningThreshold": 80000
}
}
}
}
Error: "Connection Refused" to API
Error: connect ECONNREFUSED api.anthropic.com:443
Fix:
# Check internet connection ping api.anthropic.com # Check if behind a proxy echo $HTTP_PROXY echo $HTTPS_PROXY # Configure proxy if needed openclaw config set proxy http://your-proxy:8080 # Or check firewall/VPN settings
Gateway Errors
Error: "EADDRINUSE: Port already in use"
Error: listen EADDRINUSE: address already in use :::18789
Fix:
# Find what's using the port lsof -i :18789 # Kill the process kill -9# Or use a different port openclaw gateway start --port 18790 # Update config to use new port openclaw config set gateway-port 18790
Error: "Gateway failed to start"
Error: Gateway failed to start: Cannot read config file
Fix:
# Validate config file syntax openclaw config validate # If corrupted, reset to defaults openclaw config reset --confirm # Then reconfigure openclaw onboard
Error: "Gateway not responding"
# Check if gateway is running openclaw status # If stopped, check why openclaw logs --tail 100 # Try restarting openclaw gateway restart # If still failing, check system resources free -h # Memory df -h # Disk space
Channel-Specific Errors
WhatsApp: "Session expired"
Error: WhatsApp session invalid or expired
Fix:
# Re-authenticate openclaw channel disconnect whatsapp openclaw channel connect whatsapp # Scan the new QR code
WhatsApp: "QR code not generating"
# Check if another session is active pkill -f "openclaw.*whatsapp" # Clear old session data rm -rf ~/.openclaw/whatsapp-session # Try again openclaw channel connect whatsapp
Telegram: "Conflict: terminated by other getUpdates"
Error: Conflict: terminated by other getUpdates request
Another instance is using the same bot token.
Fix:
# Stop all OpenClaw instances pkill -f openclaw # Check for other running instances ps aux | grep openclaw # Start fresh openclaw gateway start
Discord: "Invalid token"
Error: An invalid token was provided
Fix:
# Regenerate token in Discord Developer Portal # Bot → Reset Token # Update OpenClaw openclaw config set discord-token NEW_TOKEN openclaw gateway restart
Discord: "Missing intents"
Error: Disallowed intents specified
Fix:
- Go to Discord Developer Portal
- Select your application → Bot
- Enable required intents under "Privileged Gateway Intents"
- Save and restart OpenClaw
Memory and Performance Errors
Error: "JavaScript heap out of memory"
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
Fix:
# Increase Node.js memory limit export NODE_OPTIONS="--max-old-space-size=4096" # Add to your shell profile for persistence echo 'export NODE_OPTIONS="--max-old-space-size=4096"' >> ~/.bashrc # Restart OpenClaw openclaw gateway restart
Error: "Too many open files"
Error: EMFILE: too many open files
Fix:
# Check current limit ulimit -n # Increase limit (temporary) ulimit -n 65535 # Increase limit (permanent - Linux) echo "* soft nofile 65535" | sudo tee -a /etc/security/limits.conf echo "* hard nofile 65535" | sudo tee -a /etc/security/limits.conf # macOS sudo launchctl limit maxfiles 65535 200000
Slow Response Times
Diagnose:
# Check model latency openclaw benchmark # Check system resources openclaw stats
Fix:
// ~/.openclaw/openclaw.json
{
"model": {
"default": "claude-3-5-haiku",
"streaming": true,
"maxContextTokens": 4096
},
"gateway": {
"caching": {
"enabled": true,
"ttl": 300
}
}
}
Configuration Errors
Error: "Invalid YAML syntax"
Error: Config file has invalid YAML syntax at line 15
Fix:
# Validate YAML openclaw config validate # Common issues: # - Tabs instead of spaces (use 2 spaces) # - Missing colons after keys # - Unquoted special characters # Fix or reset openclaw config edit # or openclaw config reset --confirm
Error: "Unknown configuration key"
Warning: Unknown configuration key 'gateway.unknownOption'
Fix:
# Check available options openclaw config list # Remove unknown keys openclaw config edit
Error: "Environment variable not set"
Error: Required environment variable ANTHROPIC_API_KEY is not set
Fix:
# Add to .env file echo "ANTHROPIC_API_KEY=sk-ant-xxxxx" >> ~/.openclaw/.env # Or export in shell export ANTHROPIC_API_KEY=sk-ant-xxxxx # Add to shell profile for persistence echo 'export ANTHROPIC_API_KEY=sk-ant-xxxxx' >> ~/.bashrc
Database and Storage Errors
Error: "Database locked"
Error: SQLITE_BUSY: database is locked
Fix:
# Stop OpenClaw openclaw gateway stop # Check for lock files ls -la ~/.openclaw/*.lock # Remove stale locks rm ~/.openclaw/*.lock # Restart openclaw gateway start
Error: "Disk quota exceeded"
Error: ENOSPC: no space left on device
Fix:
# Check disk usage df -h # Clear OpenClaw logs and cache openclaw cache clear openclaw logs clear --older-than 7d # Clear old sessions rm -rf ~/.openclaw/sessions/*.old
Getting More Help
Enable Debug Logging
# Set debug mode export OPENCLAW_DEBUG=true openclaw gateway start # Or in config openclaw config set logLevel debug
Generate Diagnostic Report
openclaw doctor --report > diagnostic-report.txt
Community Support
- Discord : discord.gg/openclaw
- GitHub Issues : github.com/openclaw/openclaw/issues
- Documentation : docs.openclaw.ai
Filing a Bug Report
When reporting issues, include:
# System info openclaw --version node --version uname -a # Configuration (redact sensitive data) openclaw config show --redact # Recent logs openclaw logs --tail 100