When you're running AI agents with OpenClaw, things will break. It's not a question of if, but when. The good news? Most errors follow predictable patterns, and once you know where to look, debugging becomes straightforward.
I've spent hours debugging OpenClaw setups - on my Mac Mini, on EC2 instances, on VPS servers. This guide covers the most common issues I've hit and the exact steps to fix them.
Where to Look First
Before diving into specific errors, you need to know where OpenClaw logs its problems.
Check the status:
openclaw statusThis shows you if the gateway is running, which model is active, and basic config info. If something's obviously wrong (like "gateway not running"), you've found your starting point.
Enable verbose mode:
openclaw config set verbose trueNow OpenClaw will log detailed information about every request, tool call, and model interaction. This is your debugging superpower.
Read the logs:
openclaw gateway logs
# or for real-time monitoring
openclaw gateway logs --followMost errors show up here with stack traces, API responses, and timing info.
Need help with AI integration?
Get in touch for a consultation on implementing AI tools in your business.
Common Error #1: Connection and API Issues
Symptom: "Failed to connect to model provider" or timeout errors.
Cause: Wrong API keys, network issues, or provider downtime.
Fix:
- Verify your API key is correct:
openclaw model list
# Check if your provider shows up with correct config- Test the connection manually:
# For OpenAI
curl https://api.openai.com/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
# For Anthropic
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: YOUR_API_KEY"If curl fails, the problem is with your key or network, not OpenClaw.
-
Check your firewall or VPN. Some providers block certain regions or IPs.
-
If using a local model (Ollama, LM Studio), make sure the server is actually running:
# For Ollama
curl http://localhost:11434/api/tagsCommon Error #2: Model Not Found
Symptom: "Model X not found" or routing errors.
Cause: Typo in model name, provider not configured, or model not pulled yet (for local models).
Fix:
- List available models:
openclaw model list-
Check the exact model name. It's case-sensitive. Use
gpt-4o, notGPT-4oorgpt4o. -
For Ollama models, pull them first:
ollama pull llama3.3
# Then add to OpenClaw
openclaw model add ollama:llama3.3- Verify your config file (
~/.openclaw/config.json) has the provider correctly set up:
{
"providers": {
"openai": {
"apiKey": "sk-..."
}
}
}Common Error #3: Permission Errors
Symptom: "EACCES: permission denied" or file write errors.
Cause: OpenClaw can't write to its config directory or workspace.
Fix:
- Check ownership of the OpenClaw config directory:
ls -la ~/.openclaw/If it's owned by root (common after sudo usage), fix it:
sudo chown -R $USER:$USER ~/.openclaw/- Verify workspace permissions:
ls -la ~/agents/
# Make sure your user can write here- For Docker setups, ensure volume mounts have correct permissions:
docker exec openclaw ls -la /home/user/.openclaw/Discover My Projects
Check out the projects I'm working on and the technologies I use.
Common Error #4: Out of Memory or Timeout
Symptom: Process killed, "heap out of memory", or request timeout errors.
Cause: Large context, heavy tools, or underpowered server.
Fix:
- Reduce context window. If using Ollama with huge context, trim it:
openclaw model add ollama:llama3.3 --context-length 4096- Increase Node.js memory limit:
export NODE_OPTIONS="--max-old-space-size=4096"
openclaw gateway restart-
Use a smaller model.
gpt-4o-miniis faster and cheaper thangpt-4ofor most tasks. -
For timeouts, increase the timeout in config:
{
"timeout": 120000
}Common Error #5: Config File Corruption
Symptom: "Unexpected token" or "invalid JSON" errors on startup.
Cause: Manually edited config with syntax errors.
Fix:
- Validate your config JSON:
cat ~/.openclaw/config.json | jq .
# If jq shows an error, your JSON is broken- Backup and reset:
mv ~/.openclaw/config.json ~/.openclaw/config.json.backup
openclaw config init
# Re-add your models manually- Never edit JSON by hand if you can avoid it. Use
openclaw config setinstead:
openclaw config set model.default "gpt-4o"Debugging Tools You Should Know
Verbose mode (mentioned earlier) is your #1 tool. But here are others:
Check gateway health:
curl http://localhost:3721/health
# Should return 200 OKInspect a specific session:
openclaw session list
openclaw session history <session-id>Test a model directly without agents:
openclaw chat --model gpt-4o
# Type a message and see if the model respondsCheck network connectivity:
openclaw diagnose networkWant to integrate AI in your business?
Contact me for a consultation on how to implement AI tools in your company.
When to Ask for Help
If you've tried the steps above and still stuck, it's time to reach out:
OpenClaw Discord: https://discord.com/invite/clawd
- Active community, maintainers respond quickly
- Share your logs (use pastebin for long traces)
- Mention your OS, OpenClaw version, and what you tried
GitHub Issues: https://github.com/openclaw/openclaw/issues
- For reproducible bugs
- Include: OS, Node version, OpenClaw version, full error trace
- Minimal reproduction steps help immensely
Before posting:
- Run
openclaw statusand share the output - Check if your issue already exists in GitHub
- Include relevant logs (not the entire 10MB file, just the error section)
Preventive Tips
Stop errors before they happen:
1. Pin your OpenClaw version. Don't auto-update in production:
npm install -g [email protected]2. Use environment variables for secrets:
export OPENAI_API_KEY="sk-..."
# Instead of hardcoding in config.json3. Set up health checks. If running 24/7, monitor the gateway:
# Add to cron
*/5 * * * * curl -f http://localhost:3721/health || systemctl restart openclaw4. Keep logs rotating. Logs can grow huge:
openclaw config set logRetention 7
# Keep only last 7 days5. Test config changes in a separate profile:
openclaw config set --profile test model.default "claude-opus-4"
openclaw chat --profile test
# If it works, apply to main profileSummary
Most OpenClaw errors boil down to:
- Connection issues - check API keys and network
- Config problems - validate JSON, check model names
- Permissions - fix ownership of .openclaw directory
- Resource limits - reduce context or increase memory
- Tool/skill bugs - check skill code, enable verbose mode
Start with openclaw status and verbose logging. Read the error message carefully - it usually tells you exactly what's wrong. And when stuck, the OpenClaw community is there to help.
Debugging AI agents isn't magic. It's methodical troubleshooting. Once you learn the patterns, you'll fix most issues in minutes instead of hours.
