#Gateway does not restart

20 messages · Page 1 of 1 (latest)

mint mist
#

I went through the setup process and was working fine. However, I cannot get the gateway to open. When I run the command openclaw gateway, it hangs after connecting to the discord bot.

violet smeltBOT
#

I think this part is expected: openclaw gateway runs the Gateway in the foreground, so after it connects to Discord it will just sit there and keep serving, it does not return to the shell.

A few quick checks:

  1. What does this show?

    openclaw --version
    
  2. If you want the web UI, open:

    http://127.0.0.1:18789/
    

    Then run:

    openclaw gateway status
    
#
   openclaw status
  1. If you installed the daemon/service, use:
    openclaw gateway restart
    
    not openclaw gateway, unless you specifically want a one-off foreground debug run.

If it still feels stuck, paste the output of:

openclaw --version
openclaw gateway status
openclaw status --all
mint mist
#

Openclaw version: OpenClaw 2026.4.14 (323493f)
Output of openclaw gateway status
🦞 OpenClaw 2026.4.14 (323493f) — Ah, the fruit tree company! 🍎



Service: systemd (enabled)
File logs: /tmp/openclaw/openclaw-2026-04-15.log
Command: /usr/bin/node /home/jierark/.npm-global/lib/node_modules/openclaw/dist/index.js gateway --port 18789
Service file: ~/.config/systemd/user/openclaw-gateway.service
Service env: OPENCLAW_GATEWAY_PORT=18789

Config (cli): ~/.openclaw/openclaw.json
Config (service): ~/.openclaw/openclaw.json

Gateway: bind=loopback (127.0.0.1), port=18789 (service args)
Probe target: ws://127.0.0.1:18789
Dashboard: http://127.0.0.1:18789/
Probe note: Loopback-only gateway; only local clients can connect.

Runtime: stopped (state activating, sub auto-restart, last exit 1, reason 1)
RPC probe: failed
RPC target: ws://127.0.0.1:18789
gateway closed (1006):

Service is loaded but not running (likely exited immediately).
File logs: /tmp/openclaw/openclaw-2026-04-15.log
Logs: journalctl --user -u openclaw-gateway.service -n 200 --no-pager

Troubles: run openclaw status
Troubleshooting: https://docs.openclaw.ai/troubleshooting

output of openclaw status --all coming in a second message

violet smeltBOT
#

Yep, this narrowed it down.

Two separate things are happening:

  1. openclaw gateway “hanging” is normal. It runs in the foreground and keeps serving.
  2. Your systemd service is crash-looping. The key line is:
    Runtime: stopped (state activating, sub auto-restart, last exit 1)

So the next useful bit is the actual startup error.

Please paste these when you have them:

openclaw status --all
journalctl --user -u openclaw-gateway.service -n 100 --no-pager
#

If you want one more live check:

openclaw gateway restart
openclaw logs --follow

Also, if openclaw gateway is running manually, try opening this on the same machine:

http://127.0.0.1:18789/

From the docs, the usual causes for last exit 1 are:

  • missing gateway.mode=local
  • bind/auth refusal
mint mist
#

the output of openclaw status --all is too long for discord, so i'll send it piece by piece. sorry for formatting issues.
Overview
│ Version │ 2026.4.14
│ OS │ linux 6.17.0-20-generic (x64)
│ Node │ 22.22.2
│ Config │ ~/.openclaw/openclaw.json
│ Dashboard │ http://127.0.0.1:18789/
│ Tailscale │ of
│ Channel │ stable (default)
│ Update │ pnpm · up to date · npm latest 2026.4.14 │
│ Gateway │ local · ws://127.0.0.1:18789 (local loopback) · unreachable (gateway closed (1006): ) │
│ Security │ Run: openclaw security audit --deep │
│ Gateway self │ unknown │
│ Gateway service │ systemd installed · enabled · stopped (state failed) │
│ Node service │ systemd not installed │
│ Agents │ 1 total · 1 bootstrapping · 1 active · 2 sessions │
│ Secrets │ 1 diagnostic

violet smeltBOT
#

No worries, that formatting is fine.

That overview confirms the important part: the gateway is not staying up (Gateway service ... stopped (state failed)), so this is no longer about Discord specifically.

Instead of pasting all of status --all, the most useful next bits are:

  1. the Secrets diagnostic section from status --all
  2. the service error from:
    journalctl --user -u openclaw-gateway.service -n 60 --no-pager
    

If you want to keep it short, just paste the first lines that mention things like:

  • gateway.mode
  • EADDRINUSE
  • refusing to bind
#
  • failed
  • error
  • TypeError

That should give us the real cause a lot faster than the full report.

mint mist
#

Diagnosis (read-only)

Gateway connection details:
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /home/jierark/.openclaw/openclaw.json
Bind: loopback

✓ Config: /home/jierark/.openclaw/openclaw.json
! Secret diagnostics (1)

  • status --all: gateway secrets.resolve unavailable (gateway closed (1006 abnormal closure (no close frame)): no close reason
    Gateway target: ws://127.0.0.1:18789
    Source: local loopback
    Config: /home/jierark/.openclaw/openclaw.json
    Bind: loopback); resolved command secrets locally.
    ✓ Restart sentinel: none
    ✓ Port 18789
    ! Tailscale: off · unknown
    ✓ Skills: 8 eligible · 0 missing · /home/jierark/.openclaw/workspace
    ✓ Plugin compatibility (none)
    ! Channel issues skipped (gateway unreachable)
violet smeltBOT
#

This is helpful, and the good news is the secret diagnostic is probably not the root cause. It’s basically saying “the gateway is down, so I couldn’t ask it about secrets.”

So far we’ve ruled out:

  • wrong config path
  • wrong bind mode
  • port mismatch
  • missing skills/plugins

At this point we need the actual crash line from the service.

Please paste this next:

journalctl --user -u openclaw-gateway.service -n 80 --no-pager
#

If that’s still too long, filter it a bit:

journalctl --user -u openclaw-gateway.service -n 80 --no-pager | grep -Ei 'error|failed|exception|typeerror|eaddrinuse|gateway.mode|bind'

That should expose the real reason the service exits.

mint mist
#

Apr 15 16:55:49 Jierark-laptop node[48629]: 2026-04-15T16:55:49.715-04:00 [secrets] [SECRETS_RELOADER_DEGRADED] SecretRefResolutionError: Environment variable "DISCORD_BOT_TOKEN" is missing or empty.
Apr 15 16:55:49 Jierark-laptop node[48629]: 2026-04-15T16:55:49.717-04:00 Gateway failed to start: Error: Startup failed: required secrets are unavailable. SecretRefResolutionError: Environment variable "DISCORD_BOT_TOKEN" is missing or empty.
Apr 15 16:55:49 Jierark-laptop systemd[1720]: openclaw-gateway.service: Failed with result 'exit-code'.
Apr 15 16:55:54 Jierark-laptop systemd[1720]: openclaw-gateway.service: Failed with result 'exit-code'.
Apr 15 16:55:54 Jierark-laptop systemd[1720]: Failed to start openclaw-gateway.service - OpenClaw Gateway (v2026.4.14).

violet smeltBOT
#

Nice, we found it.

The real issue is:

Environment variable "DISCORD_BOT_TOKEN" is missing or empty

So the gateway service is failing because your Discord token is configured as an env SecretRef, but systemd does not see that env var.

Also, your original openclaw gateway “hangs after connecting” report is actually normal, that command runs the gateway in the foreground.

Fix

Best fix, put the token in the OpenClaw global env file on the machine running it:

#
nano ~/.openclaw/.env

Add:

DISCORD_BOT_TOKEN=your_token_here

Then restart:

openclaw gateway restart
openclaw gateway status
#

If you prefer, you can also enable shell env import instead of relying on systemd inheriting your shell env:

openclaw config set env.shellEnv.enabled true --strict-json
openclaw gateway restart

Important

Do not paste your bot token here in Discord.

Docs:

If gateway status turns into Runtime: running + RPC probe: ok, you’re good. If this fixed it, please right-click the solution message → Apps → ✅ Mark Solution so Answer Overflow can index it 🎉

mint mist
#

Real quick: I'm running into this error

when running the onboarding. I was trying to reconfigure my model.

violet smeltBOT
#

Yep, that looks like a known wizard regression, not your model config specifically.

There are fresh reports that openclaw configure / openclaw onboard can crash with:

TypeError: Cannot read properties of undefined (reading 'trim')

when the wizard hits the Channels step.

Relevant issues:

Workaround

If you just want to reconfigure the model, avoid the full onboarding flow and run only the model section: