Troubleshooting Guide

Fix common OpenClaw problems - Discord bot offline, Ollama slow or not loading, gateway crashes, config errors, install failures. Step-by-step with actual commands.

Reference All levels Free Updated May 2026

Five Commands That Answer Almost Everything

Before you dig into specific errors, run these five commands. Between them, they'll tell you whether OpenClaw is running, whether your config is valid, what the logs are saying, and whether you're hitting memory pressure. Most issues reveal themselves immediately.

☁️ Server - run these first, every time
# 1. Is OpenClaw actually running?
openclaw status

# 2. Is the config valid?
openclaw doctor

# 3. What do the logs say?
openclaw logs --tail 50

# 4. If you're using Ollama - is it running?
systemctl status ollama

# 5. Is the server running out of memory?
free -h
openclaw statusfirst stop
Tells you whether the gateway is running, stopped, or in an error state. If it says stopped, run openclaw gateway restart and check the logs. If it says running but your bot isn't responding, the problem is config or permissions.
openclaw doctorconfig check
Validates your config file without restarting anything. Catches JSON errors, unknown keys, wrong types, and missing environment variables. If doctor reports a problem, fix that before doing anything else. Most "gateway won't start" issues are caught here.
openclaw logsthe real story
The logs tell you what OpenClaw is actually doing - connection errors, bad tokens, model timeouts, pairing events. When your bot isn't responding, the answer is almost always in here. Add --follow to watch live as you test.
systemctl status ollamaif using local models
If OpenClaw can't reach your local model, Ollama is probably not running. Fix: sudo systemctl start ollama. Enable on boot: sudo systemctl enable ollama.
free -hmemory check
If you're running Ollama alongside OpenClaw, RAM is often the bottleneck. If "available" is under 1GB, you're in swap territory and everything will be slow. Consider a smaller model or closing other processes.
Jump to your section. Use the sidebar to go straight to the issue you're dealing with. Installation errors, gateway problems, Discord, Telegram, and Ollama issues each have their own section with specific fixes.

The Install Script Won't Run

Most install failures come down to three things: curl isn't installed, Node.js is the wrong version, or npm doesn't have the right permissions. Here's how to fix each one.

curl: command not found

The install script needs curl. Install it first:

☁️ Server
sudo apt update && sudo apt install -y curl
curl -fsSL https://openclaw.ai/install.sh | bash

Node.js version too old

OpenClaw requires Node.js 22.19 or higher. Ubuntu's default apt repositories ship an older version. If you see an error about the Node version, pull it from NodeSource instead:

☁️ Server
# Remove the old version if present
sudo apt remove nodejs -y

# Install Node.js 24 from NodeSource
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo bash -
sudo apt install -y nodejs

# Verify
node --version   # should show v24.x.x
npm --version

Then re-run the OpenClaw install:

☁️ Server
sudo npm install -g openclaw@latest

openclaw: command not found (after install)

The install completed but the shell doesn't know where to find the command yet. Your PATH hasn't updated in the current session:

☁️ Server
# Reload your shell config
source ~/.bashrc

# Or just open a new terminal session and try again
openclaw --version

If it still says command not found after reloading, find where npm puts global packages and add it to your PATH:

☁️ Server
npm prefix -g               # shows the global prefix path
ls $(npm prefix -g)/bin    # openclaw should be in here

# Add to PATH if missing (replace /usr/local with your prefix)
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Permission denied during npm install

Running npm install -g without sudo can fail on permission errors. Running with sudo can sometimes cause different permission problems. The cleanest fix:

☁️ Server
# Use sudo with npm for global installs on Ubuntu
sudo npm install -g openclaw@latest

If sudo npm causes issues (sometimes it conflicts with nvm setups), fix npm's global prefix to a user-owned directory instead:

☁️ Server
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
npm install -g openclaw@latest

Onboarding wizard exits immediately

If the onboarding wizard starts and then immediately closes or errors out, it's usually one of these:

No TTYSSH issue
The wizard needs an interactive terminal. If you piped something into it or ran it non-interactively, it exits. Just run openclaw onboard --install-daemon directly in your SSH session with nothing piped in.
Already onboardedconfig exists
If a config file already exists from a previous install attempt, onboarding may skip or exit early. Check: cat ~/.openclaw/openclaw.json. If it exists and is incomplete, delete it and re-run: rm ~/.openclaw/openclaw.json && openclaw onboard --install-daemon

How to update OpenClaw

☁️ Server
# Built-in update command
openclaw update

# Or force reinstall via npm
sudo npm install -g openclaw@latest

# Check current version
openclaw --version

Gateway Won't Start or Keeps Crashing

The gateway is the core process that runs OpenClaw. If it won't start or keeps dying, the problem is almost always a config error, a port conflict, or a missing environment variable. openclaw doctor catches most of these before you even try to restart.

Always run openclaw doctor first

☁️ Server
openclaw doctor

Doctor parses your config, checks for schema violations, and verifies that any environment variables referenced with ${VAR_NAME} actually exist. If it reports an error, fix that first. The gateway won't start with a broken config.

JSON / JSON5 parse errors

A missing comma, mismatched brace, or stray character in openclaw.json will prevent the gateway from starting. The error message points to the approximate line number - that's where to look.

Missing commamost common
Every section in the config needs a comma after its closing brace if something follows it. Forgetting the comma between the gateway block and the channels block is the single most common config mistake.
Mismatched bracessecond most common
Every { needs a closing }. Paste your config into a JSON validator like jsonlint.com to instantly find the mismatch.
Restore backupfastest fix
If you made a backup before editing (you did run cp openclaw.json openclaw.json.bak, right?): cp ~/.openclaw/openclaw.json.bak ~/.openclaw/openclaw.json then restart clean.

Environment variable not found

If your config references ${DISCORD_BOT_TOKEN} or similar and that variable isn't set, the gateway refuses to start with a clear error message.

☁️ Server - check if variable exists
echo $DISCORD_BOT_TOKEN      # should print your token
echo $TELEGRAM_BOT_TOKEN     # if using Telegram

If it prints nothing, the variable isn't set in the current session. Fix:

☁️ Server - set permanently via shell profile
echo 'export DISCORD_BOT_TOKEN="your-token-here"' >> ~/.bashrc
source ~/.bashrc

For a production server, set it in the systemd service file instead so it survives reboots and works regardless of which user is logged in:

☁️ Server - systemd service override
sudo systemctl edit openclaw
📝 Add this block in the editor
[Service]
Environment="DISCORD_BOT_TOKEN=your-token-here"
Environment="TELEGRAM_BOT_TOKEN=your-token-here"
☁️ Server - reload and restart
sudo systemctl daemon-reload
openclaw gateway restart

Port 18789 already in use

If another process is already using port 18789, the gateway won't bind to it. Find what's using it:

☁️ Server
sudo lsof -i :18789

If it's an old OpenClaw process that didn't shut down cleanly, kill it: sudo kill -9 <PID> then restart. If it's something else, change the gateway port in your config to something unused (e.g. 18790) and update your firewall rules to match.

Gateway starts then immediately stops

This almost always means a runtime error on startup. Check the last 50 log lines:

☁️ Server
openclaw logs --tail 50

Look for lines with ERROR or FATAL. Common causes at this stage: bad API key for the AI provider, invalid model string, or a channel token that was already revoked.

OpenClaw stopped after a server reboot

If OpenClaw was set up as a systemd service during onboarding, it should start automatically on boot. If it didn't:

☁️ Server
# Check if service is enabled for auto-start
systemctl is-enabled openclaw

# Enable it if not
sudo systemctl enable openclaw

# Start it now
openclaw gateway restart

If the service doesn't exist yet (you skipped the daemon step during onboarding), re-run onboarding and accept the systemd install this time: openclaw onboard --install-daemon

Bot Offline or Not Responding

Discord bot problems almost always come down to four things: wrong token, missing intents, pairing issues, or the gateway not actually running. Work through these in order.

Bot shows as offline in Discord

Check statusstep one
Run openclaw status. If the gateway is stopped, run openclaw gateway restart and wait 20 seconds. The bot should come online.
Check logsfor token errors
Run openclaw logs --tail 30. Look for 4004 in the logs - that's Discord's "authentication failed" code, which means your bot token is wrong or has been revoked. Go to the Discord Developer Portal, reset the token, update your config, and restart.
Token formatcheck for issues
Bot tokens look like: MTExxx.GYxxxx.xxxxxxx. If yours has extra spaces, line breaks, or is missing a section, it won't authenticate. Re-copy from the Developer Portal → Bot → Reset Token.

Bot is online but not responding to messages

This is the most common Discord problem after setup. The bot connects fine but goes completely silent. 90% of the time this is the Message Content Intent.

Message Content Intentmost common cause
Without this intent enabled, Discord strips all message text before it reaches OpenClaw. Your bot literally cannot see what you're typing.

Fix: Go to discord.com/developers/applications → your app → Bot → scroll to Privileged Gateway Intents → enable Message Content Intent → Save Changes. Then restart the gateway: openclaw gateway restart.
Bot not in serversecond check
If you reset or regenerated the bot invite link, you may need to re-invite the bot. Go back to Developer Portal → OAuth2 → URL Generator, regenerate the invite with the right scopes and permissions, open it in a browser, and re-add to your server.
dmPolicy blockingthird check
If dmPolicy is set to allowlist, your Discord user ID must be in the allowFrom list. Check your config - cat ~/.openclaw/openclaw.json - and verify your user ID is there. Right-click your username in Discord (with Developer Mode on) to copy your user ID.

Pairing code not working

Pairing codes expire after a few minutes. If the code in the Discord message isn't working, it's probably stale. Send another message to the bot to trigger a fresh code, then approve immediately:

☁️ Server - approve pairing
openclaw pairing approve discord PAIRING_CODE

If you keep getting pairing prompts even after approving, the approval isn't persisting - check that OpenClaw has write access to its workspace directory: ls -la ~/.openclaw/workspace/

Bot responds in DMs but not in the server channel

The bot needs View Channels and Read Message History permissions in the specific channel. Check:

Channel permissionscheck these
In Discord, right-click the channel → Edit Channel → Permissions → find your bot's role. Confirm: View Channel, Send Messages, and Read Message History are all checked green.
@mention formatare you tagging correctly?
In a server channel, OpenClaw only responds when @mentioned. Type @YourBotName your message here. If you're just typing in the channel without the @mention, the bot intentionally ignores it.

Bot was working, now suddenly stopped

Server rebootedcheck first
If your cloud or home server rebooted and OpenClaw didn't auto-start, run openclaw gateway restart and make sure it's enabled: sudo systemctl enable openclaw.
Token revokedcheck logs
Discord occasionally forces token resets for security reasons. Check openclaw logs --tail 20 for error code 4004. If you see it, reset the token in the Developer Portal and update your config.
Rate limitedtoo many requests
If the bot sent a lot of messages in a short window, Discord may have rate limited it temporarily. Wait 10-15 minutes. It recovers on its own.

Local Models Not Loading or Running Slow

Ollama issues almost always trace back to one of three things: the service isn't running, you don't have enough RAM for the model you chose, or the model string in your OpenClaw config doesn't match what Ollama expects. Here's how to sort each one.

Connection refused - Ollama API unreachable

If OpenClaw can't reach Ollama, check whether Ollama is actually running:

☁️ Server
# Check service status
systemctl status ollama

# Start it if stopped
sudo systemctl start ollama

# Enable on boot so this doesn't happen again
sudo systemctl enable ollama

# Verify the API is reachable
curl http://localhost:11434/api/tags

The curl command should return a JSON list of your installed models. If you get "connection refused", Ollama isn't running. If you get an empty list, it's running but you haven't pulled any models yet.

Model won't load - "failed to load model" or instant timeout

If Ollama is running but a specific model refuses to load, RAM is almost always the reason. Check how much you have free vs. how much the model needs:

☁️ Server
# How much RAM is free right now?
free -h

# Which models are currently loaded in Ollama?
ollama ps

# How big is the model you're trying to use?
ollama list
Quick RAM Guide
  • 8GB RAM total: Run 3B models (llama3.2:3b, ~3GB). 7B models are tight - other processes may push you into swap.
  • 16GB RAM: 7B models comfortably (qwen3:8b, deepseek-r1:7b). Two 7B models at once gets tight.
  • 32GB RAM: 14B models comfortably. Two 7B models simultaneously with room to spare.

If you're out of headroom, unload models that aren't being used - Ollama keeps recently used models in memory. Or switch to a smaller model. The Best Local AI Models 2026 guide has the full breakdown of what fits where.

Ollama is slow - responses taking forever

CPU-only inference is inherently slower than GPU. This is normal - here's what "normal" looks like and what you can do about it:

💻 Realistic CPU speeds (7B model, q4_K_M)
Budget / older CPU (4 cores):    3-6 tokens/sec
Mid-range (8 cores, 16 threads): 8-15 tokens/sec
High-end (12+ cores):            15-25 tokens/sec
Apple Silicon M2/M3:             30-50+ tokens/sec

At 10 tokens/sec, a 200-word response takes about 30-40 seconds. That's normal for CPU inference - not broken, just the physics of running AI locally.

Things that actually help:

Smaller modelbiggest win
Drop from a 7B to a 3B model. llama3.2:3b runs at 2-3x the speed of a 7B on the same hardware and is surprisingly capable for most tasks.
Reduce context windowmeaningful speedup
A large context window means more computation per token. If you don't need long conversations, lower num_ctx in your Ollama config. Try 2048 or 4096 instead of the default 32768. See the Ollama Advanced tutorial for how to set this.
Avoid swapcritical
If the model doesn't fit in RAM and spills into swap (SSD/HDD storage), performance drops to almost nothing. Run free -h and check that "available" is comfortably above your model's RAM requirement.
Close other processeseasy win
Other CPU-heavy processes compete with Ollama. On a dedicated mini PC or server, stop anything that doesn't need to be running during AI inference.

OpenClaw can't find the model - wrong model string

If OpenClaw is configured to use Ollama but the model name doesn't match exactly, it'll fail silently or throw a model-not-found error. Check:

☁️ Server - list installed models
ollama list

The name shown in ollama list is what goes in your OpenClaw config. The format in openclaw.json is ollama/modelname:

📄 openclaw.json - correct model string format
model: {
  primary: "ollama/qwen3:8b"    // matches "qwen3:8b" in ollama list
}

If you pulled the model with a specific tag like qwen3:8b-q8_0, use that exact tag. ollama/qwen3:8b and ollama/qwen3:8b-q8_0 are different entries.

Model download stuck or failed

☁️ Server
# Cancel with Ctrl+C and retry
ollama pull qwen3:8b

# Check available disk space
df -h

Most failed downloads are either a network timeout or a full disk. Qwen3:8b is 5.2GB - make sure you have at least 8GB free (the model plus working space). If disk is the issue, remove models you're not using: ollama rm modelname.

Commands Worth Memorizing

Everything in one place. Bookmark this section - these are the commands you'll reach for every time something acts up.

OpenClaw Core Commands

☁️ Server - OpenClaw management
# Check if everything is running
openclaw status

# Validate config without restarting
openclaw doctor

# View recent logs
openclaw logs --tail 50

# Stream logs live (great for debugging)
openclaw logs --follow

# Restart the gateway (apply config changes)
openclaw gateway restart

# Add a new channel interactively
openclaw channels add

# Update to the latest version
openclaw update

# Enter the TUI (chat from terminal)
openclaw tui

# Approve a pairing request
openclaw pairing approve discord YOUR_CODE
openclaw pairing approve telegram YOUR_CODE

Ollama Commands

☁️ Server - Ollama management
# Check Ollama service status
systemctl status ollama

# Start / stop / restart Ollama
sudo systemctl start ollama
sudo systemctl stop ollama
sudo systemctl restart ollama

# Enable Ollama to start on boot
sudo systemctl enable ollama

# List installed models
ollama list

# See currently loaded models (and VRAM/RAM usage)
ollama ps

# Pull a model
ollama pull qwen3:8b
ollama pull llama3.2:3b

# Remove a model
ollama rm modelname

# Test the Ollama API directly
curl http://localhost:11434/api/tags

# Quick test prompt (replace model name as needed)
curl http://localhost:11434/api/generate -d '{
  "model": "qwen3:8b",
  "prompt": "Hello, are you working?",
  "stream": false
}'

System Diagnostics

☁️ Server - system checks
# RAM - check available memory
free -h

# CPU usage - what's eating cycles
top

# Disk space - make sure you have room for models
df -h

# Check what's using a port (e.g. 18789 or 11434)
sudo lsof -i :18789
sudo lsof -i :11434

# Check if openclaw systemd service is enabled
systemctl is-enabled openclaw

# View systemd service logs (if openclaw runs as a service)
journalctl -u openclaw -n 50

Config File

☁️ Server - config management
# View current config
cat ~/.openclaw/openclaw.json

# Back up before editing (do this every time)
cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak

# Open for editing
nano ~/.openclaw/openclaw.json

# Validate after editing
openclaw doctor

# Restore backup if you broke something
cp ~/.openclaw/openclaw.json.bak ~/.openclaw/openclaw.json
openclaw gateway restart

Still Stuck?

If none of the above solved it, a few more places to look:

Full logsnot just --tail
openclaw logs without --tail dumps everything. Search for the word ERROR: openclaw logs | grep -i error
Journalctlsystem-level logs
journalctl -u openclaw --since "10 minutes ago" - catches crashes and errors that happen before OpenClaw's own logging kicks in.
GitHub Issuesofficial channel
github.com/openclaw/openclaw/issues - search before opening a new one. Someone has probably hit the same thing. Include your openclaw --version output and the relevant log lines.
Most problems resolve with three commands: openclaw doctor to check the config, openclaw logs --tail 50 to find the actual error, and openclaw gateway restart to apply the fix. Everything else in this guide is just variations on that loop.