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.
# 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 gateway restart and check the logs.
If it says running but your bot isn't responding, the problem is config or permissions.
--follow to watch live as you test.
sudo systemctl start ollama. Enable on boot:
sudo systemctl enable ollama.
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:
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:
# 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:
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:
# 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:
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:
# 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:
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:
openclaw onboard --install-daemon
directly in your SSH session with nothing piped in.
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
# 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
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.
gateway block and
the channels block is the single most common config mistake.
{ needs a closing }. Paste your config into
a JSON validator like jsonlint.com
to instantly find the mismatch.
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.
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:
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:
sudo systemctl edit openclaw
[Service]
Environment="DISCORD_BOT_TOKEN=your-token-here"
Environment="TELEGRAM_BOT_TOKEN=your-token-here"
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:
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:
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:
# 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
openclaw status. If the gateway is stopped, run
openclaw gateway restart and wait 20 seconds. The bot
should come online.
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.
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.
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.
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:
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:
@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
openclaw gateway restart and make sure it's enabled:
sudo systemctl enable openclaw.
openclaw logs --tail 20 for error code 4004.
If you see it, reset the token in the Developer Portal and update your config.
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:
# 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:
# 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
- 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:
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:
llama3.2:3b runs at 2-3x the speed
of a 7B on the same hardware and is surprisingly capable for most tasks.
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.
free -h and check that
"available" is comfortably above your model's RAM requirement.
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:
ollama list
The name shown in ollama list is what goes in your OpenClaw config.
The format in openclaw.json is ollama/modelname:
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
# 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
# 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
# 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
# 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
# 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:
openclaw logs without --tail dumps everything.
Search for the word ERROR: openclaw logs | grep -i error
journalctl -u openclaw --since "10 minutes ago" - catches crashes
and errors that happen before OpenClaw's own logging kicks in.
openclaw --version output and the relevant log lines.
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.