When the OpenClaw gateway stops, the rest of the stack stops with it.
You open the dashboard, or send your agent a message, and nothing comes back. openclaw gateway status says stopped or unreachable. You run a restart, it hangs, then exits with Port 18789 is already in use. Or it starts, dies 30 seconds later, and starts again in a loop.
This is rarely a broken install. In almost every case the gateway is failing on one of six things: a stale background service, a config file that no longer validates, a port conflict, a full disk, two competing OpenClaw installs, or a database migration that did not finish after an update. Identify which one you have and the fix is usually one command. It is almost never a rebuild.
The myth that costs people a day: delete ~/.openclaw and start over
Search any support thread and someone will tell you to wipe ~/.openclaw and reinstall. It feels decisive. It is also the most expensive thing you can do.
That folder holds openclaw.json, your exec approval rules, paired channels, agent workspaces, cron jobs, and the SQLite state file that stores sessions, memory indexes, and run history. Wiping it trades a ten minute diagnosis for a full rebuild: re-pair every channel, re-create every cron job, re-approve every tool, and lose the context your agent has built up.
Wiping only helps in one narrow case, a state database that is genuinely corrupt, and even then you restore from a backup first. For the other five causes it changes nothing. The service comes back with the same stale path, the same invalid config, or the same port conflict.
Why the gateway fails to start
The gateway is a single long-lived process. Everything else depends on it: the dashboard, chat channels, cron jobs, heartbeats, and sub-agents. When it cannot start, the failure is one of six branches.
- Service stopped or stale. The background service is missing, stopped, or still points at an older OpenClaw binary after an update.
- Invalid configuration. OpenClaw refuses to boot when the config does not validate, or when a newer version wrote a config your current CLI does not understand.
- Port conflict. Another process, or a second gateway, already owns port 18789.
- Disk or filesystem pressure. The process cannot write state, logs, or SQLite data.
ENOSPCis the giveaway. - Split installation. Your shell CLI and the managed gateway resolve to different Node or OpenClaw installations, so they fight over the same state.
- Post-update migration failure. Long-lived state needs a version-specific recovery step, not another restart.
How to confirm which one you have
Run this ladder in order. Stop at the first failure. That failure names your branch.
- Check what you are actually running. Run
which openclaw, thenopenclaw --version. If the path is a global npm shim from an older Node install, you already have the split installation problem. - Get the whole picture. Run
openclaw status --all. It shows the gateway runtime line, model status, and channel errors in one place. - Inspect the runtime. Run
openclaw gateway status --deep. A healthy gateway reportsRuntime: runningand a successful connectivity probe. - Watch the first fatal block only. Run
openclaw logs --follow. Do not scroll. The first fatal error is the cause, everything after it is fallout. Redact tokens before you paste the log anywhere. - Validate the config read-only. Run
openclaw config validateandopenclaw doctor --lint. Both point at a named config path instead of a vague failure. - Find the port owner. Run
lsof -nP -iTCP:18789 -sTCP:LISTENon macOS or Linux. On Linux,ss -ltnp | grep 18789works too. If nothing is listening but startup still claims the port is busy, wait a minute for the old socket to clear. - Check space and ownership. Run
df -h, thenls -ld ~/.openclaw. If the process runs as a different user than the one that owns the folder, it cannot write state. - Check the last update. Run
openclaw update status --json. If the failure started right after an update or shows a migration error, treat it as branch six.

The fixes, in order of cost
1. Restart the service, then reinstall it if the metadata is stale
One supervised restart is reasonable. Repeated restarts are not a plan.
Run openclaw gateway restart, then openclaw gateway status --deep. If the runtime is still stopped, or the service points at a binary you no longer use, reinstall the service from the CLI you actually want:
openclaw gateway install --force followed by openclaw gateway restart. Verify with openclaw gateway probe. Expected result: Reachable: yes and a runtime that stays up for more than a minute.
2. Repair the config instead of replacing it
Back up openclaw.json first, then fix the exact path the validator named. Replacing the whole file with an old copy is how people lose channel credentials and model routing.
Run openclaw config validate, fix the named key, validate again. If lint offers a supported repair, run openclaw doctor --fix once and recheck. If the same error returns after a repair, stop repeating the command. You have not found the cause yet.
3. Take back port 18789
A port conflict means something already owns the listener. Identify it before killing anything.
If the listener is your intended gateway, do not launch a second copy. Fix the client URL or auth path instead. If it is an obsolete OpenClaw service, stop that specific service and reinstall the intended one. If it is unrelated software, move one of the two to a different port deliberately and update the config on both sides.
Expected result: lsof shows one listener, and openclaw gateway status reports running with a passing probe.
4. Free the disk and the state directory
ENOSPC and permission errors look like crashes but are not. Free space outside ~/.openclaw first: old logs, old backups, and container images you do not use.
Inside the folder, prune sessions rather than deleting them. openclaw sessions prune --older-than 30d is safe. Deleting SQLite, memory, or config files to make the process start is not safe, and it is not necessary. If ownership is wrong, fix the owner of the state directory so it matches the user the gateway runs as.
5. Recover a failed post-update migration
If the crash loop began after an update, generic restarts will not fix it. Record the installed version and update channel, take a backup of ~/.openclaw, then follow the version-specific recovery steps. The OpenClaw upgrade playbook covers the backup, rollback, and verification sequence in order.
Do not copy a random rollback version from a forum, and do not move conflict files without a verified backup. Expected result: the gateway starts cleanly on a known version, and openclaw doctor --post-upgrade reports no blocking findings.
6. If it keeps happening, move the runtime off your laptop
Some causes are structural. A laptop that sleeps, two Node versions installed by two different tools, and a machine you also use for work will keep producing the same failures. Restarting fixes the symptom, not the pattern.
If you want the gateway to run somewhere it is not competing with your daily work, a managed host removes the service, update, and port layer entirely. ClawTrust provisions OpenClaw for you, keeps it loopback-bound with no exposed ports, and handles the updates. Plans start at $29 per month with a 5-day free trial. Worth it if the gateway going down costs you a morning.
Self-hosted vs managed: which fits your situation
| Option | Best For | Starting Price | Rating | Get Started |
|---|---|---|---|---|
| Self-hosted on your own machine | Full control, no monthly fee, you own the debugging | $0 | 3/5 for uptime | Official docs |
| ClawTrust Lite | One agent, own email address, chat channels, bring your own model key | $29/mo, 5-day trial | 4/5 | Start trial |
When it is worth paying
The free fixes above solve most startup failures, and you should try them first. Paying makes sense when the failure repeats. If the gateway has gone down twice in a month, or if you are the only person who can debug it, the cost of that downtime is usually higher than a $29 plan.
It also makes sense when the machine is the problem: a laptop that sleeps, a desktop that reboots for updates, or a home connection that drops. In those cases self-hosting works until it does not, and the fix is to stop hosting the runtime on the device you work on.
Another process already owns the port. That is usually an old OpenClaw gateway that did not shut down, but it can also be a second install or unrelated software. Run lsof -nP -iTCP:18789 -sTCP:LISTEN to see the process id before you kill anything. If it is your intended gateway, fix the client connection instead of starting a second copy.
No. That folder contains your config, channel pairings, cron jobs, exec approvals, agent workspaces, and the SQLite state that holds sessions and memory. Deleting it turns a small fix into a full rebuild. Restore from a backup if the state database is corrupt, and repair the specific failing file otherwise.
A running process is not the same as a healthy one. Run openclaw channels status --probe to see live transport state per account, and openclaw gateway probe to confirm the connection. Silent channels are usually a token, pairing, or permissions issue rather than a startup failure.
A normal package reinstall does not delete your state, because it lives in ~/.openclaw rather than the install directory. Deleting that folder does. Back it up before any recovery step, especially before a rollback or a migration repair.
Yes. A small VPS or a managed OpenClaw host keeps the gateway running when your laptop sleeps. Managed hosts handle the service, updates, and port exposure for you. Self-hosting on a VPS costs less but you remain responsible for restarts, backups, and security patches.
If the gateway starts but the dashboard still will not load, the problem has moved up a layer, and the gateway binding and remote access guide is the next stop.
Final thoughts: do this first
You can diagnose this in about ten minutes if you stop guessing.
- Capture the evidence. Note
openclaw --versionand the first fatal line fromopenclaw logs --follow. Do not restart again until you have both. - Run the ladder. Status, deep gateway status, config validate. The first command that fails tells you which of the six causes you have.
- Fix one branch, then verify. Restart once, confirm
openclaw healthandopenclaw channels status --probe, and only then re-enable cron jobs and unattended work.
If the same failure returns a third time, stop patching it. Move the runtime to a machine that stays awake and is not running your daily tools. That is the upgrade path, and it removes the whole class of problem rather than one instance of it.

