Gateway Troubleshooting
Gateway Troubleshooting
Section titled “Gateway Troubleshooting”This guide helps you diagnose and resolve common issues with OpenClaw Gateway. It covers startup problems, connection issues, performance problems, and error scenarios.
Quick Diagnosis
Section titled “Quick Diagnosis”Health Check
Section titled “Health Check”Start with a comprehensive health check:
# Check overall gateway healthopenclaw gateway health
# Detailed statusopenclaw gateway status --detailed
# Check all channelsopenclaw channels status --all
# Test agent connectivityopenclaw agent testCommon Issues Overview
Section titled “Common Issues Overview”| Issue Category | Common Symptoms | Quick Fix |
|---|---|---|
| Startup | Gateway won’t start, crashes immediately | Check configuration, permissions, ports |
| Network | Can’t connect to messaging platforms | Verify internet, credentials, API status |
| Performance | Slow responses, high memory usage | Check resources, optimize configuration |
| Authentication | Token errors, permission denied | Verify tokens, check permissions |
| Messages | Messages not sending/receiving | Check channel configuration, logs |
Startup Issues
Section titled “Startup Issues”Gateway Won’t Start
Section titled “Gateway Won’t Start”Check Configuration
Section titled “Check Configuration”# Validate configuration syntaxopenclaw config validate
# Show configurationopenclaw config show
# Check specific sectionsopenclaw config validate --section gatewayopenclaw config validate --section channelsCommon Configuration Errors
Section titled “Common Configuration Errors”Invalid JSON syntax:
# Error: Configuration file contains invalid JSON# Fix: Check JSON syntaxcat ~/.openclaw/openclaw.json | jq .
# Or use online JSON validatorMissing required fields:
# Error: Missing required field 'gateway.port'# Fix: Add missing fieldopenclaw config set gateway.port 18789Invalid values:
# Error: Invalid port number# Fix: Use valid port (1-65535)openclaw config set gateway.port 18789Permission Issues
Section titled “Permission Issues”# Check file permissionsls -la ~/.openclaw/
# Fix permissionschmod 600 ~/.openclaw/openclaw.jsonchmod 700 ~/.openclaw/
# Check process permissionsps aux | grep openclaw
# Run as correct usersudo -u username openclaw gatewayPort Conflicts
Section titled “Port Conflicts”# Check if port is in usenetstat -an | grep 18789lsof -i :18789
# Kill conflicting processsudo kill -9 <PID>
# Or use different portopenclaw config set gateway.port 19000Gateway Crashes on Startup
Section titled “Gateway Crashes on Startup”Check Logs
Section titled “Check Logs”# View startup logsopenclaw gateway logs --tail 50
# View error logsopenclaw gateway logs --level error
# View logs with timestampopenclaw gateway logs --follow --timestampCommon Crash Causes
Section titled “Common Crash Causes”Memory issues:
# Check available memoryfree -h
# Increase memory limitopenclaw config set gateway.maxMemory "2GB"
# Use 64-bit version if availableDependency issues:
# Check Node.js versionnode --version # Should be 22+
# Reinstall dependenciesnpm install -g openclaw@latest
# Or from sourcecd /path/to/openclawnpm installnpm buildNetwork Issues
Section titled “Network Issues”Cannot Connect to Messaging Platforms
Section titled “Cannot Connect to Messaging Platforms”General Network Check
Section titled “General Network Check”# Check internet connectivityping 8.8.8.8curl -I https://www.google.com
# Check DNS resolutionnslookup api.telegram.orgnslookup web.whatsapp.com
# Check firewallsudo ufw statussudo iptables -LWhatsApp Connection Issues
Section titled “WhatsApp Connection Issues”# Test WhatsApp connectivityopenclaw channels test whatsapp
# Check WhatsApp Web statuscurl -I https://web.whatsapp.com
# Check QR code generationopenclaw channels login whatsapp --test
# Common fixes:# 1. Ensure WhatsApp is not active elsewhere# 2. Check network connectivity# 3. Re-scan QR codeopenclaw channels logout whatsappopenclaw channels login whatsappTelegram Connection Issues
Section titled “Telegram Connection Issues”# Test Telegram APIcurl -X GET "https://api.telegram.org/bot<TOKEN>/getMe"
# Test bot tokenopenclaw channels test telegram --token "YOUR_TOKEN"
# Check webhook statusopenclaw channels webhook status telegram
# Common fixes:# 1. Verify bot token is correct# 2. Check bot is not blocked by Telegram# 3. Ensure webhook URL is accessibleopenclaw config set channels.telegram.webhook.enabled falseopenclaw config set channels.telegram.polling.enabled trueDiscord Connection Issues
Section titled “Discord Connection Issues”# Test Discord APIcurl -X GET "https://discord.com/api/v10/users/@me" \ -H "Authorization: Bot <TOKEN>"
# Test gateway connectionopenclaw channels test discord
# Check bot permissions# 1. Go to Discord Developer Portal# 2. Verify bot has correct intents# 3. Check bot is in server with proper permissions
# Reconnect Discordopenclaw channels reconnect discordSSL/TLS Issues
Section titled “SSL/TLS Issues”Certificate Problems
Section titled “Certificate Problems”# Check SSL certificateopenssl s_client -connect api.telegram.org:443
# Check certificate expirationopenssl s_client -connect api.telegram.org:443 2>/dev/null | \ openssl x509 -noout -dates
# Fix certificate issues (Linux)sudo update-ca-certificates
# Fix certificate issues (macOS)brew update && brew upgrade ca-certificatesWebhook SSL Issues
Section titled “Webhook SSL Issues”# Test webhook SSLcurl -X POST https://your-domain.com/webhook/telegram \ -H "Content-Type: application/json" \ -d '{"test": true}'
# Generate self-signed certificate (testing)openssl req -newkey rsa:2048 -new -nodes -x509 -days 365 \ -keyout key.pem -out cert.pem
# Use Let's Encrypt (production)certbot certonly --standalone -d your-domain.comPerformance Issues
Section titled “Performance Issues”Slow Response Times
Section titled “Slow Response Times”Check Resource Usage
Section titled “Check Resource Usage”# Check CPU and memory usagetop -p $(pgrep openclaw)htop -p $(pgrep openclaw)
# Check memory usage specificallyps aux | grep openclaw | grep -v grep
# Check disk I/Oiotop -p $(pgrep openclaw)
# Check network I/Oiftop -i eth0Optimize Configuration
Section titled “Optimize Configuration”# Increase worker processesopenclaw config set gateway.workers 4
# Optimize database settingsopenclaw config set gateway.database.poolSize 10
# Enable cachingopenclaw config set gateway.cache.enabled trueopenclaw config set gateway.cache.maxSize "100MB"
# Optimize message processingopenclaw config set gateway.batchSize 50openclaw config set gateway.batchTimeout 1000Memory Leaks
Section titled “Memory Leaks”# Monitor memory over timewatch -n 5 'ps aux | grep openclaw'
# Generate memory dumpkill -USR1 $(pgrep openclaw)
# Check for memory leaksopenclaw gateway memory-profile
# Restart gateway if neededopenclaw gateway restartHigh CPU Usage
Section titled “High CPU Usage”Identify CPU-intensive operations
Section titled “Identify CPU-intensive operations”# Profile CPU usageopenclaw gateway profile --cpu
# Check which operations are slowopenclaw gateway logs --filter performance
# Optimize agent executionopenclaw config set agents.default.timeout 30000openclaw config set agents.default.maxTokens 2048Reduce CPU Usage
Section titled “Reduce CPU Usage”# Limit concurrent operationsopenclaw config set gateway.maxConcurrent 10
# Enable rate limitingopenclaw config set security.rateLimit.enabled true
# Optimize polling intervalsopenclaw config set channels.telegram.polling.interval 2000Authentication Issues
Section titled “Authentication Issues”Token Problems
Section titled “Token Problems”Invalid or Expired Tokens
Section titled “Invalid or Expired Tokens”# Check token validityopenclaw gateway validate-token
# Generate new tokenopenclaw gateway generate-token
# Rotate all tokensopenclaw gateway rotate-tokens
# Check token expirationopenclaw gateway list-tokens --show-expirationAPI Key Issues
Section titled “API Key Issues”# Test API keysopenclaw agent test --provider anthropicopenclaw agent test --provider openai
# Update API keysexport ANTHROPIC_API_KEY="new-key"export OPENAI_API_KEY="new-key"
# Test with new keysopenclaw agent testPermission Issues
Section titled “Permission Issues”File Permissions
Section titled “File Permissions”# Check configuration file permissionsls -la ~/.openclaw/openclaw.json
# Fix permissionschmod 600 ~/.openclaw/openclaw.jsonchmod 700 ~/.openclaw/
# Check log file permissionsls -la ~/.openclaw/logs/
# Fix log permissionschmod 640 ~/.openclaw/logs/*macOS Permissions (iMessage)
Section titled “macOS Permissions (iMessage)”# Check Full Disk Accessls -la ~/Library/Messages/chat.db
# Reset permissionssudo tccutil reset All com.apple.Messages
# Test imsg CLIimsg versionimsg list-chats
# Re-grant permissions# System Settings → Privacy & Security → Full Disk Access# Add OpenClaw and imsgMessage Issues
Section titled “Message Issues”Messages Not Sending
Section titled “Messages Not Sending”Check Channel Status
Section titled “Check Channel Status”# Check all channelsopenclaw channels status --all
# Check specific channelopenclaw channels status whatsapp
# Test channel connectivityopenclaw channels test whatsapp
# Check message queueopenclaw gateway queue --channel whatsappCommon Send Failures
Section titled “Common Send Failures”Rate limiting:
# Check rate limit statusopenclaw channels status --rate-limit
# Wait and retryopenclaw message send --channel whatsapp --target "+1234567890" \ --message "Test" --retry 3Invalid recipient:
# Validate recipientopenclaw message validate --channel whatsapp --target "+1234567890"
# Check allowed recipientsopenclaw config get channels.whatsapp.allowFromNetwork issues:
# Test network connectivityping web.whatsapp.comcurl -I https://api.telegram.org
# Check firewallsudo ufw statusMessages Not Receiving
Section titled “Messages Not Receiving”Check Receiver Configuration
Section titled “Check Receiver Configuration”# Check if receiver is runningopenclaw gateway status
# Check receiver logsopenclaw gateway logs --filter receiver
# Test message receptionopenclaw channels test-receive whatsappWebhook Issues
Section titled “Webhook Issues”# Check webhook statusopenclaw channels webhook status telegram
# Test webhook endpointcurl -X POST http://localhost:8443/webhook/telegram \ -H "Content-Type: application/json" \ -d '{"update_id": 123, "message": {"text": "test"}}'
# Restart webhookopenclaw channels webhook restart telegramError Scenarios
Section titled “Error Scenarios”Database Issues
Section titled “Database Issues”Database Corruption
Section titled “Database Corruption”# Check database integrityopenclaw gateway db-check
# Repair databaseopenclaw gateway db-repair
# Rebuild databaseopenclaw gateway db-rebuild
# Backup before repairopenclaw gateway backupDatabase Lock Issues
Section titled “Database Lock Issues”# Check for database locksopenclaw gateway db-status
# Clear locksopenclaw gateway db-clear-locks
# Restart databaseopenclaw gateway restart-dbAgent Issues
Section titled “Agent Issues”Agent Not Responding
Section titled “Agent Not Responding”# Check agent statusopenclaw agent status
# Test agent connectionopenclaw agent test
# Restart agentopenclaw agent restart
# Check agent logsopenclaw agent logsAgent Execution Errors
Section titled “Agent Execution Errors”# Check agent configurationopenclaw config get agents.default
# Test with simple promptopenclaw agent test --prompt "Hello"
# Check model availabilityopenclaw agent test --model claude-3.5-sonnet
# Enable debug loggingopenclaw config set logging.components.agent debugDebug Tools
Section titled “Debug Tools”Debug Mode
Section titled “Debug Mode”# Start gateway in debug modeopenclaw gateway --debug
# Enable debug loggingopenclaw config set logging.level debug
# Debug specific componentopenclaw config set logging.components.whatsapp debug
# View debug logsopenclaw gateway logs --follow --level debugProfiling
Section titled “Profiling”# CPU profilingopenclaw gateway profile --cpu --duration 30
# Memory profilingopenclaw gateway profile --memory --duration 30
# Network profilingopenclaw gateway profile --network --duration 30
# Generate flame graphopenclaw gateway profile --flamegraphHealth Monitoring
Section titled “Health Monitoring”# Continuous health monitoringopenclaw gateway monitor --interval 60
# Health check with alertsopenclaw gateway monitor --alert-email admin@example.com
# Export health metricsopenclaw gateway metrics --format prometheusRecovery Procedures
Section titled “Recovery Procedures”Complete Gateway Reset
Section titled “Complete Gateway Reset”# Backup current configurationopenclaw gateway backup
# Stop gatewayopenclaw gateway stop
# Reset configuration (careful!)openclaw config reset
# Reinitializeopenclaw onboard --force
# Restore from backup if neededopenclaw gateway restore backup-2024-01-15.jsonDisaster Recovery
Section titled “Disaster Recovery”# Restore from backupopenclaw gateway restore --backup latest
# Verify restorationopenclaw gateway health
# Test all channelsopenclaw channels test --all
# Send test messageopenclaw message testGetting Help
Section titled “Getting Help”Support Resources
Section titled “Support Resources”# Generate support bundleopenclaw support bundle --output support-bundle.tar.gz
# Check versionopenclaw --version
# Check system infoopenclaw system-info
# Export logsopenclaw logs export --last 24h --format jsonCommunity Support
Section titled “Community Support”- GitHub Issues: github.com/openclaw/openclaw/issues
- Discord Community: discord.gg/openclaw
- Documentation: docs.openclaw.dev
Bug Reports
Section titled “Bug Reports”When filing bug reports, include:
# System informationopenclaw system-info
# Configuration (sanitized)openclaw config show --sanitize
# Recent logsopenclaw logs export --last 1h
# Health statusopenclaw gateway health --detailedTroubleshooting Commands Reference
Section titled “Troubleshooting Commands Reference”# Health and Statusopenclaw gateway healthopenclaw gateway status [--detailed]openclaw channels status [--all]openclaw agent status
# Testingopenclaw channels test <channel>openclaw agent test [--model <model>]openclaw message test
# Configurationopenclaw config validate [--section <section>]openclaw config show [--section <section>]openclaw config get <path>
# Logs and Debuggingopenclaw gateway logs [--follow] [--level <level>]openclaw channels logs <channel>openclaw agent logs
# Recoveryopenclaw gateway restartopenclaw gateway backupopenclaw gateway restore <backup>openclaw config reset💡 Developer Wellness
Section titled “💡 Developer Wellness”“Debugging is temporary. Inner peace is forever. Powered by Coffee & Stoic Philosophy.”
When you’re deep in troubleshooting mode, remember that technical challenges are temporary. Take a moment to breathe, step back, and approach problems with a calm, rational mindset.
For those moments when you need a philosophical perspective on debugging and life, consider exploring timeless wisdom at StoicLines.store — where ancient philosophy meets modern development challenges.
With this troubleshooting guide, you should be able to diagnose and resolve most OpenClaw Gateway issues. For additional help, reach out to the community! 🛠️