#Openclaw startup

1 messages · Page 1 of 1 (latest)

lethal oarBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

green anvilBOT
#

That “close all terminals” warning usually means you’ve accidentally got more than one Gateway process running (often started from different terminals), so they fight over the same port and you get disconnects.

Get it back online (quick triage)

Run these and paste the output here (especially any error lines):

openclaw --version
openclaw gateway status
openclaw logs --follow

What you want to see in openclaw gateway status is Runtime: running and RPC probe: ok. (That’s the “gateway is up and reachable” baseline.)
Docs runbook: https://docs.openclaw.ai/gateway/troubleshooting

If it’s a “multiple gateways / port in use” situation

If logs/status mention things like EADDRINUSE or “another gateway instance is already listening”, do this:

#
  1. Stop the running service-managed gateway:
openclaw gateway stop
  1. Make sure you don’t still have a terminal running openclaw gateway ... in the foreground (Ctrl+C in that terminal).

  2. Start clean again:

openclaw gateway start
# or
openclaw gateway restart

If you’re totally stuck and it keeps saying the port is taken, the runbook also mentions:

#
openclaw gateway --force

(which force-kills whatever is listening on the gateway port and then starts the gateway) — only use that if you’re sure it’s just a stuck old OpenClaw gateway.

Brave Search setup: make it survive restarts

A super common gotcha: people set BRAVE_API_KEY only in one terminal, then restart the gateway as a service and the key “disappears”.

Recommended fix (stores it in config):

openclaw configure --section web

Docs: https://docs.openclaw.ai/tools/web

Prevent this in the future

  • Run one gateway (prefer the installed service) and use openclaw gateway restart after config changes instead of launching extra gateways from new terminals.
#
  • Put API keys in config via openclaw configure ... (or in the gateway service environment), not just in a one-off terminal env.
  • When something goes weird: openclaw doctor is designed to catch config/service drift.

If you paste the exact line that told you to “close all terminals” + your gateway status, I can tell you which of the above cases you’re in within a minute.

calm knoll
#

i am getting this should I not run this in a admin terminal openclaw : File C:\Users\mgt72\AppData\Roaming\npm\openclaw.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1

  • openclaw --version
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS C:\Users\mgt72> openclaw gateway status
openclaw : File C:\Users\mgt72\AppData\Roaming\npm\openclaw.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1

  • openclaw gateway status
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS C:\Users\mgt72> openclaw logs --follow
openclaw : File C:\Users\mgt72\AppData\Roaming\npm\openclaw.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1

  • openclaw logs --follow
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS C:\Users\mgt72>

green anvilBOT
#

That error isn’t about “admin terminal” — it’s PowerShell blocking the openclaw.ps1 launcher script (ExecutionPolicy). So right now none of the openclaw ... commands can run from PowerShell until you use one of these fixes.

Fastest workaround (no policy change)

In PowerShell, run the .cmd shim instead of the .ps1 one:

openclaw.cmd --version
openclaw.cmd gateway status
openclaw.cmd logs --follow

If that works, you can keep using openclaw.cmd in PowerShell, or just use Command Prompt (cmd.exe) where openclaw usually works normally.

Permanent fix (lets openclaw work normally in PowerShell)

This is the common dev setting; it does not require Admin if you use CurrentUser:

#

Once you can run the CLI again, paste the output of:

openclaw --version
openclaw gateway status

…and I’ll tell you the exact “get reconnected” steps. The earlier “disconnect / too many terminals” symptom is very often “two gateways are running / port conflict”, and the fix is usually openclaw gateway stop → openclaw gateway start (but let’s confirm from gateway status first).

calm knoll
#

I got some messaging but it says Runtime: stopped (state Ready, last run time 3/2/2026 2:42:08 PM)
RPC probe: gateway closed (1006 abnormal closure (no close frame)): no close reason

green anvilBOT
#

That status means the Gateway process is not running anymore, so anything trying to talk to it (Control UI / tools / live search) gets a WebSocket disconnect:

  • Runtime: stopped = the gateway service/process exited
  • RPC probe: gateway closed (1006 ...) = the client tried to connect, but the gateway wasn’t there (or crashed mid-connection)

1) Get it running again (pick the one that matches how you run it)

A) If you installed the Gateway as a service/daemon

Run:

openclaw gateway start
openclaw gateway status

If it starts but stops again immediately:

#
openclaw logs --follow

(Logs will usually say why it exited.)

B) If you were running it in a terminal window

Then closing that terminal stops the gateway.

Start it again and leave that terminal open:

openclaw gateway --port 18789 --verbose

Then in a second terminal:

#
openclaw gateway status
openclaw logs --follow

2) Most common cause (matches your “too many terminals” suspicion)

Two gateway instances / port conflict → one starts, the other dies, the UI disconnects.

Do this “clean slate” sequence:

openclaw gateway stop
openclaw gateway start
openclaw gateway status

If it still flaps, we need the logs.

#

3) What I need from you to diagnose in one shot

Please paste:

openclaw --version
openclaw gateway status --deep
openclaw doctor

…and the first ~30 lines of openclaw logs --follow right after you try openclaw gateway start.

4) Prevent it in the future

  • Prefer a single supervised gateway (service/daemon) instead of starting it from random terminals. See runbook: https://docs.openclaw.ai/gateway
  • Don’t set Brave key only in a one-off terminal—store it in config:
    openclaw configure --section web
    
#

Docs: https://docs.openclaw.ai/tools/web

  • After config changes: openclaw gateway restart

One quick clarification: are you doing this native Windows PowerShell or inside WSL2 (Ubuntu)? The exact “best” setup differs a lot on Windows.

calm knoll
#

give me the start command in .cmd form

green anvilBOT
#

Use the exact same commands, just replace openclaw with openclaw.cmd.

Start the gateway (service-managed)

openclaw.cmd gateway start
openclaw.cmd gateway status

Or run it in the foreground (debug)

openclaw.cmd gateway --port 18789 --verbose

Follow logs

openclaw.cmd logs --follow
#

If openclaw.cmd gateway start immediately goes back to Runtime: stopped, paste the first error chunk from:

openclaw.cmd logs --follow
calm knoll
#

when I did that a second windows powershell thing popped up with a lot of different color text what do I do with this one

green anvilBOT
#

That second PowerShell window with colored text is almost certainly the Gateway process output (logs).

What to do:

  1. Leave that window open (don’t close it).

    • If you close it and the gateway is running “in the foreground”, the gateway will stop.
  2. Go back to your original terminal and check if the gateway is actually up:

openclaw.cmd gateway status

You want: Runtime: running and RPC probe: ok.

  1. If it is running, open the UI in a browser:
openclaw.cmd dashboard
#

(or go to http://127.0.0.1:18789/)

  1. If that colored-text window shows errors and then exits, copy/paste the last ~30 lines from it here — that’ll tell us why it keeps stopping.

Quick question: which command did you run right before that second window appeared — openclaw.cmd gateway start or openclaw.cmd gateway --port 18789 --verbose?

calm knoll
#

I ran openclaw.cmd gateway start - also in telegram I gave the bot the 3/1/26 update and it said it did also in my gateway it says its that version but in telegram it says the vesrsion is 2026.2.14

green anvilBOT
#

That’s a really useful clue.

1) Why Telegram shows 2026.2.14 while your local gateway shows a newer version

Almost always: you have two different OpenClaw gateways running (or you updated one install, but Telegram is still connected to the other one).

With Telegram specifically: a bot token can only be “owned” by one running gateway at a time. If an old gateway (2026.2.14) is still alive somewhere (another terminal, WSL, another PC/VPS), it will keep answering Telegram and can also cause the new gateway to disconnect/stop.

2) The “second PowerShell window with lots of colored text”

That window is very likely the actual gateway process output that openclaw.cmd gateway start launched. Don’t type into it unless it prompts you — it’s mainly for logs/errors.

If it closes by itself, it usually means the gateway crashed or exited (and the last lines in that window are the reason).


Fix: make sure only ONE gateway is running, then start it

Do this from your main PowerShell:

#
  1. Stop the service-managed gateway (if installed):
openclaw.cmd gateway stop
  1. Close any other terminals that might be running openclaw gateway ... (including old ones).

  2. Start it again:

openclaw.cmd gateway start
  1. Immediately check:
openclaw.cmd gateway status --deep
openclaw.cmd logs --follow
#

Please paste the output of gateway status --deep and the first error-looking chunk from logs --follow. That will tell us:

  • whether it’s starting and then dying
  • whether it’s fighting a second instance
  • whether Telegram is failing with a “bot already in use” type error

Quick question (this matters on Windows)

Are you running OpenClaw inside WSL2 (Ubuntu) anywhere on this machine too?
If yes, it’s very common to have one gateway in WSL and one on Windows, and Telegram ends up connected to the “wrong” one.

calm knoll
#

inside the gateway dashboard inside config it says 2026.3.1 but in the top right corner it has green circle, version 2026.2.14

green anvilBOT
#

That mismatch pretty much confirms you’ve got two different OpenClaw installs / gateway processes in the mix.

  • The green dot + “version 2026.2.14” in the Control UI header is the actual Gateway you’re connected to.
  • If some other place in the UI/config is showing 2026.3.1, that’s likely coming from a different install/version (or cached UI bits), but it’s not the gateway Telegram/UI is currently talking to.

And since Telegram also reported 2026.2.14 earlier: your Telegram bot token is almost certainly still connected to an older gateway instance somewhere (could be another terminal, WSL, another PC/VPS).

Step 1 — Confirm what “gateway start” actually launched

In that second PowerShell window with the colored logs, scroll to the very top (or near the first startup lines). It should print the gateway version on startup.

If it says 2026.2.14, then openclaw.cmd gateway start is launching the old install.

Step 2 — Find “which openclaw am I running” (Windows)

In PowerShell, run and paste output:

#
where.exe openclaw
where.exe openclaw.cmd
openclaw.cmd --version

If where shows more than one path, Windows is picking one (often the older one).

Step 3 — Make sure ONLY ONE gateway is running (Telegram requires this)

On every machine/environment you might have used (Windows, WSL, VPS, etc.), stop the gateway.

On this Windows box, try:

openclaw.cmd gateway stop
#

Then start again:

openclaw.cmd gateway start
openclaw.cmd gateway status

If you also have WSL: run wsl, then inside Ubuntu run openclaw gateway stop too (otherwise the WSL gateway can “steal” Telegram).

Step 4 — Recommended long-term on Windows

OpenClaw is recommended via WSL2 on Windows (way fewer “two installs / weird shims” problems):
https://docs.openclaw.ai/platforms/windows


Send the outputs from Step 2 and I’ll tell you exactly which one is the “wrong” OpenClaw and how to remove/upgrade it so everything (Gateway + Telegram) is on the same version.

calm knoll
#

it says 2026.3.1 in the logs

green anvilBOT
#

If the gateway logs say 2026.3.1, then the gateway you just started really is 2026.3.1.

So the “green circle + version 2026.2.14” you’re seeing in the web UI is almost certainly one of these two things:

A) You’re actually connected to a different gateway (old one) on a different URL/port

Please paste the exact URL from your browser address bar (host + port), e.g. http://127.0.0.1:18789/ or something else.

Then in PowerShell run and paste:

openclaw.cmd gateway status --deep

(This will tell us what port/instance is actually running.)

B) Browser cache (old Control UI assets)

This is common after updates.

Try one of these:

#
  • Hard reload: Ctrl+Shift+R
  • Open the dashboard in an Incognito/InPrivate window
  • Clear site data for 127.0.0.1:18789 (cookies + cache), then reload

After that, check whether the top-right version updates.


Also: make sure only one gateway is running

To avoid “two gateways fighting” / disconnects:

openclaw.cmd gateway stop
openclaw.cmd gateway start
openclaw.cmd gateway status
calm knoll
#

Other gateway-like services detected (best effort):

  • \OpenClaw Gateway (system, task: \OpenClaw Gateway, run: C:\Users\mgt72.openclaw\gateway.cmd)
    Cleanup hint: schtasks /Delete /TN "OpenClaw Gateway" /F

Recommendation: run a single gateway per machine for most setups. One gateway supports multiple agents (see docs: /gateway#multiple-gateways-same-host).
If you need multiple gateways (e.g., a rescue bot on the same host), isolate ports + config/state (see docs: /gateway#multiple-gateways-same-host).

green anvilBOT
#

That output is from openclaw doctor and it’s basically telling you: you have a Windows Scheduled Task (“OpenClaw Gateway”) installed that can run the Gateway in the background:

  • \OpenClaw Gateway ... run: C:\Users\mgt72\.openclaw\gateway.cmd

If you also start another gateway from a terminal, you can end up with two gateways fighting (disconnects, Telegram “talking to the other one”, weird version mismatches).

Recommended: keep ONE gateway (the Scheduled Task) and just restart it

  1. Close any extra windows where you ran something like openclaw.cmd gateway --port ... (foreground gateways).

  2. Restart the service-managed gateway:

openclaw.cmd gateway stop
openclaw.cmd gateway start
openclaw.cmd gateway status --deep
  1. Then open the dashboard:
#
openclaw.cmd dashboard
  1. If the dashboard still shows an old version in the top-right, that’s usually browser cache. Do:
  • Hard refresh: Ctrl+Shift+R, or
  • Open in InPrivate/Incognito and load http://127.0.0.1:18789/

If you don’t want the Scheduled Task (manual-only)

Don’t delete it yet—first inspect it:

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

If you confirm you want it gone, I’ll walk you through removing it (that’s what the /Delete hint is about).

Next thing I need from you

Paste the output of:

#
openclaw.cmd gateway status --deep

That will tell us which gateway instance/port you’re actually connected to and why the UI header might still be showing 2026.2.14.

calm knoll
#

so what do I do I only have two terminals one is the output logs and one is the gateway why does it say I have multiple running

green anvilBOT
#

Because that “multiple gateways” warning isn’t counting your two visible terminals — it’s counting the background Scheduled Task gateway plus the one you started manually.

So you currently have (at least) one of these running “in the background”:

  • Scheduled Task: \OpenClaw Gateway running C:\Users\mgt72\.openclaw\gateway.cmd

…and then you start another one from a terminal → two gateways.

What to do (recommended)

Pick one way to run the gateway. On Windows, the easiest is: use the Scheduled Task and don’t start a second foreground gateway.

Option A — Keep the Scheduled Task (recommended)

  1. Stop any manual/foreground gateway: close the terminal window that’s running the gateway in the foreground (or Ctrl+C in that window).

  2. Restart the background one cleanly:

#
openclaw.cmd gateway stop
openclaw.cmd gateway start
openclaw.cmd gateway status --deep
  1. Use the dashboard:
openclaw.cmd dashboard

Option B — No Scheduled Task, manual only

If you prefer “I start it myself in a terminal”, then delete/disable the Scheduled Task so it can’t auto-run:

First inspect it:

#
schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

If it’s clearly the OpenClaw one, delete it:

schtasks /Delete /TN "OpenClaw Gateway" /F

Then start your gateway manually (one terminal only) and leave it open:

openclaw.cmd gateway --port 18789 --verbose

Quick check (so we don’t guess)

Run and paste:

#
openclaw.cmd gateway status --deep

That will show whether the gateway you’re talking to is the scheduled-task one or your manual one, and confirms we’ve truly got down to a single instance.

calm knoll
#

I ran the gateway status wha am I looking for

green anvilBOT
#

In openclaw.cmd gateway status you’re basically looking for “is it running, and can the CLI talk to it?”

The two key lines

  1. Runtime
  • âś… Good: Runtime: running
  • ❌ Bad: Runtime: stopped (gateway isn’t running)
  1. RPC probe
  • âś… Good: RPC probe: ok
  • ❌ Bad: anything like failed, closed (1006/1008), connection refused (CLI can’t reach the gateway)

If you can, run the “deep” one (gives more clues)

openclaw.cmd gateway status --deep

In --deep, we’re also looking for clues like:

#
  • what port it’s listening on (usually 18789)
  • what config path/state dir it’s using (to detect “two installs”)
  • anything that hints it’s being started by the Scheduled Task vs a manual terminal run

What to paste here

Paste the full output of:

openclaw.cmd gateway status --deep

Then I can tell you:

  • whether you still have two gateways (scheduled task + manual)
  • which one is “winning”
  • and the clean next step (stop one, keep the other).
calm knoll
#

Service: Scheduled Task (registered)
File logs: ~\AppData\Local\Temp\openclaw\openclaw-2026-03-02.log
Command: C:\Program Files\nodejs\node.exe C:\Users\mgt72\AppData\Roaming\npm\node_modules\openclaw\dist\index.js gateway --port 18789
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: running (last run time 3/2/2026 3:01:43 PM)
RPC probe: ok

Listening: 127.0.0.1:18789
Other gateway-like services detected (best effort):

  • \OpenClaw Gateway (system, task: \OpenClaw Gateway, run: C:\Users\mgt72.openclaw\gateway.cmd)
    Cleanup hint: schtasks /Delete /TN "OpenClaw Gateway" /F

Recommendation: run a single gateway per machine for most setups. One gateway supports multiple agents (see docs: /gateway#multiple-gateways-same-host).
If you need multiple gateways (e.g., a rescue bot on the same host), isolate ports + config/state (see docs: /gateway#multiple-gateways-same-host).

Troubles: run openclaw status
Troubleshooting: https://docs.openclaw.ai/troubleshooting
PS C:\Users\mgt72>

green anvilBOT
#

That output is actually good news — your Gateway is healthy right now:

  • Runtime: running
  • RPC probe: ok
  • Listening on 127.0.0.1:18789 (so the dashboard URL http://127.0.0.1:18789/ should work)

So you’re “back and connected”.

Why it still says “multiple gateways”

That warning is not about your two terminals anymore.

It’s saying Windows has more than one “Gateway service” definition installed:

  • The one you’re using now (shows up as Service: Scheduled Task (registered), command runs ...node_modules\openclaw\dist\index.js gateway --port 18789)
  • Another Scheduled Task also exists: it runs C:\Users\mgt72\.openclaw\gateway.cmd

That second one might not be running at this moment, but it can start later (boot/login), and then you get the “two gateways fighting / disconnects / wrong version in UI/Telegram” behavior.

#

What to do (safe approach)

  1. Don’t start any other gateways from terminals for now. Keep using the scheduled-task one since it’s working.

  2. Open Task Scheduler → Task Scheduler Library and look for “OpenClaw Gateway”.

    • If you see two, disable the one whose “Action” points to:
      C:\Users\mgt72\.openclaw\gateway.cmd
    • After disabling it and confirming everything still works, you can delete it.

(Disabling first is safer than deleting blindly.)

Version mismatch in the dashboard (2026.2.14 vs 2026.3.1)

If the gateway logs show 2026.3.1 and status is healthy, the UI showing 2026.2.14 is usually just cached UI assets. Do a hard refresh (Ctrl+Shift+R) or open the dashboard in an InPrivate window.

Prevent it in the future

  • Run one gateway (the scheduled task), and use:
    openclaw.cmd gateway restart
    instead of launching extra ones in new terminals.
#
  • Put Brave key in config so the scheduled task sees it:
    openclaw.cmd configure --section web

If you want, paste a screenshot of your Task Scheduler entry for “OpenClaw Gateway” (just the Actions section) and I’ll tell you exactly which one to disable.

calm knoll
#

what is task scheduler

green anvilBOT
#

Task Scheduler is a built-in Windows app that runs programs automatically in the background (at startup, at login, on a schedule, etc.). OpenClaw uses it on Windows to keep the Gateway running as a “service” instead of needing an open terminal.

How to open it

Pick one:

Option 1 (Start menu):

  • Press Windows key
  • Type Task Scheduler
  • Open it

Option 2 (Run box):

  • Press Win + R
  • Type:
    taskschd.msc
    
  • Press Enter
#

What to look for (for your OpenClaw issue)

  1. In the left sidebar, click Task Scheduler Library
  2. Look for a task named “OpenClaw Gateway” (or similar)
  3. Click it, then check the Actions tab:
    • One of your tasks points to C:\Users\mgt72\.openclaw\gateway.cmd (the “extra” one doctor detected)

What you should do

  • Disable the extra OpenClaw Gateway task first (right-click → Disable)
    (Safer than deleting immediately.)
  • After you confirm everything still works, you can delete it.

If you tell me what you see under Actions (copy/paste the “Program/script” line), I’ll tell you exactly which entry to disable.

calm knoll
#

do you mean task manager?

green anvilBOT
#

Not Task Manager — Task Scheduler is a different Windows tool.

  • Task Manager = shows running apps/processes right now (CPU/RAM).
  • Task Scheduler = runs things automatically in the background (startup/login/schedules). OpenClaw’s “Gateway service” on Windows is often a Scheduled Task.

How to open Task Scheduler

Win + R → type:

taskschd.msc

→ Enter.

(or Start menu → search “Task Scheduler”)

Why we care

Your openclaw gateway status --deep showed:

#
  • Service: Scheduled Task (registered) âś…
  • plus another task: \OpenClaw Gateway ... C:\Users\mgt72\.openclaw\gateway.cmd ⚠️

That extra scheduled task can start a second gateway and cause disconnects/version weirdness.

Quick check without the UI

Run this in PowerShell and paste the output:

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

Then I’ll tell you whether you should Disable or Delete that task (disabling first is safest).

calm knoll
#

I disabled it now what

green anvilBOT
#

Nice — that’s the right move.

Now do 3 quick checks

1) Verify the gateway is still healthy

openclaw.cmd gateway status --deep

You want:

  • Runtime: running
  • RPC probe: ok

2) Make sure the “extra gateway” warning is gone

Run:

openclaw.cmd doctor
#

It should no longer report that C:\Users\mgt72\.openclaw\gateway.cmd scheduled task as an “other gateway-like service” (or it may mention it but show it as disabled / not a conflict).

3) Fix the UI version mismatch (if you still see 2026.2.14)

Open the dashboard in a fresh browser session:

  • Ctrl+Shift+R (hard refresh), OR
  • open InPrivate window and load: http://127.0.0.1:18789/

After that

Try your Brave search again in chat.

If Telegram still shows the wrong version / behaves weirdly, it usually means Telegram is connected to some other old gateway somewhere else. Then we’ll check channel status:

openclaw.cmd channels status --probe

Paste the outputs of gateway status --deep and channels status --probe and I’ll tell you if you’re fully clean now.

calm knoll
#

I am still getting the multiple thing again

green anvilBOT
#

That “multiple gateways” message can mean either:

  1. Multiple gateway services are installed (even if only one is running)
  2. Multiple gateways are actually running right now (this is the bad one → disconnects)

Let’s tell which one you’ve got.

1) First: is your gateway healthy right now?

Run and paste:

openclaw.cmd gateway status --deep

If it says Runtime: running + RPC probe: ok, you’re fine at least for the running instance.

2) Check if more than one process is listening on port 18789

#

This is the quickest “are two gateways running” check:

netstat -ano | findstr :18789
  • âś… If you see one LISTENING line → only one gateway is bound to that port.
  • ❌ If you see multiple different PIDs/listeners → you’ve got a real double-run situation.

3) Disabling a Scheduled Task does not stop it if it’s already running

So even though you disabled the extra one, it might still be running in the background.

Check the task status:

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST
#

Look for lines like “Scheduled Task State” and “Status” (Running/Ready).

If it’s still running and you want to stop it immediately:

schtasks /End /TN "OpenClaw Gateway"

4) Paste this if it’s still confusing

Paste the output of:

  • openclaw.cmd gateway status --deep
  • netstat -ano | findstr :18789
  • openclaw.cmd doctor

…and I’ll tell you exactly whether you should ignore the warning (multiple installed) or you still have two running gateways and which one to kill.

calm knoll
#

can I paste the results in here

green anvilBOT
#

Yes — paste them right here in this thread.

Best is to paste these three outputs (in this order), and you can trim any long log spam:

openclaw.cmd gateway status --deep
netstat -ano | findstr :18789
#
openclaw.cmd doctor

If any of them contains secrets: it usually shouldn’t, but if you see an API key/token string, redact it (replace with ***).

calm knoll
#

PS C:\Users\mgt72> netstat -ano | findstr :18789
TCP 127.0.0.1:18789 0.0.0.0:0 LISTENING 60168
TCP 127.0.0.1:18789 127.0.0.1:56723 TIME_WAIT 0
TCP 127.0.0.1:18789 127.0.0.1:60207 ESTABLISHED 60168
TCP 127.0.0.1:60207 127.0.0.1:18789 ESTABLISHED 50912
TCP [::1]:18789 [::]:0 LISTENING 60168

green anvilBOT
#

Perfect — that netstat output shows only one process is actually listening on the gateway port:

  • LISTENING 60168 on 127.0.0.1:18789 and [::1]:18789 (IPv4 + IPv6 loopback) is normal
  • The TIME_WAIT / ESTABLISHED lines are just normal connections to the same gateway

So you do not have two gateways running on port 18789 right now.

What you’re seeing as “multiple” is almost certainly OpenClaw doctor detecting multiple installed/registered gateway services (Scheduled Tasks), even if only one is currently active.

Next 2 things to paste so I can confirm 100%

Please paste these too:

openclaw.cmd gateway status --deep
openclaw.cmd doctor
#

Optional: see what PID 60168 actually is

tasklist /FI "PID eq 60168"

If gateway status --deep still warns about another Scheduled Task, we’ll either:

  • ignore it (if it’s disabled and not running), or
  • remove the extra task so the warning goes away and it can’t ever auto-start later.
calm knoll
#

its asking migrate to legacy state now? yes or no

green anvilBOT
#

If the prompt is literally “Migrate legacy state now? (yes/no)” (sometimes it gets phrased like “legacy state detected … migrate now?”), then answer: YES.

That migration is openclaw doctor moving old on-disk folders (sessions/agent dir/WhatsApp auth, etc.) into the current layout. It’s the normal/expected step after upgrading. Docs: https://docs.openclaw.ai/gateway/doctor (see “Legacy state migrations”).

Two quick safety notes:

  1. If you want a belt-and-suspenders backup first: copy/zip C:\Users\mgt72\.openclaw\ somewhere before you answer.
  2. After it finishes, run:
openclaw.cmd gateway restart
openclaw.cmd gateway status --deep

If the prompt you see is actually saying “migrate to legacy state” (as in downgrade/revert), paste the exact line of the prompt here before you answer — that wording would be unusual, and I don’t want you to click the wrong thing.

calm knoll
#

Now its asking archive 13 orphan transcipt files in /openclaw/agents/main/session? yes or no

green anvilBOT
#

Answer YES (recommended).

“Orphan transcript files” = transcript files that don’t have a matching session entry anymore (usually from upgrades/crashes). Doctor is offering to archive them safely by renaming them to something like:

  • *.deleted.<timestamp>

So it’s not a hard delete — it’s a reversible “move aside / rename” to clean up the sessions dir and prevent weirdness.

Docs note (same behavior): https://docs.openclaw.ai/cli/doctor

If you’re paranoid, you can say No and do it later, but “Yes” is the normal thing to pick.

calm knoll
#

now what do I do it says Run "openclaw doctor --fix" to apply changes.
│
â”” Doctor complete.

green anvilBOT
#

Run that command once, then restart the gateway.

In your case (PowerShell), do:

openclaw.cmd doctor --fix
openclaw.cmd gateway restart
openclaw.cmd gateway status --deep

What this does:

  • doctor --fix applies the recommended repairs/migrations it just detected (it also makes a backup of your config as ~\.openclaw\openclaw.json.bak per the docs).
  • Restart makes sure the running Gateway picks up the updated state/config cleanly.

After that, open the dashboard again (hard refresh if needed):

#
openclaw.cmd dashboard

If anything errors during doctor --fix, paste the error text here.

calm knoll
#

Gateway restart failed: Error: schtasks run failed: ERROR: The scheduled task "OpenClaw Gateway" could not run because it is disabled.

green anvilBOT
#

You disabled the Scheduled Task that OpenClaw uses to run the Gateway, so openclaw gateway restart can’t start it anymore.

Fix (re-enable the task, then restart)

Run this in PowerShell:

schtasks /Change /TN "OpenClaw Gateway" /ENABLE
openclaw.cmd gateway start
openclaw.cmd gateway status --deep

(After that, openclaw.cmd gateway restart should work again too.)

If you disabled the wrong task (common)

You may have two OpenClaw tasks:

  • the “real” one that runs something like: ...\node_modules\openclaw\dist\index.js gateway ...
  • a legacy one that runs: C:\Users\mgt72\.openclaw\gateway.cmd
#

We want the dist\index.js one enabled. The legacy gateway.cmd one should stay disabled (or later deleted).

To confirm which one is which, paste this output:

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

Temporary workaround (if you don’t want Scheduled Tasks at all)

You can run the gateway in the foreground (but you must keep that window open):

openclaw.cmd gateway --port 18789 --verbose
calm knoll
#

what am I looking for I ran that command

green anvilBOT
#

You’re looking for which Scheduled Task you disabled and what it actually runs.

After you run:

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

scan the output for these lines (copy/paste just these parts is fine):

1) Is it disabled or enabled?

Look for something like:

  • Scheduled Task State: or
  • Status:

You want it to be Ready (enabled) or Running.
If it says Disabled, that’s why gateway restart failed.

#

2) What does it run?

Look for the command/action line, usually under something like Task To Run or Actions. You’ll see either:

Good (current) style — should be enabled:

  • runs Node + ...node_modules\openclaw\dist\index.js gateway --port 18789

Legacy style — this is the extra one doctor complained about:

  • runs: C:\Users\mgt72\.openclaw\gateway.cmd

What to paste here

Paste the parts showing:

  • Status / Scheduled Task State
  • The “Task To Run” (or action command)

Immediate fix if it’s disabled

If the task is disabled, re-enable it:

#
schtasks /Change /TN "OpenClaw Gateway" /ENABLE
openclaw.cmd gateway start

Then:

openclaw.cmd gateway status --deep
calm knoll
#

Task To Run: C:\Users\mgt72.openclaw\gateway.cmd - Scheduled Task State: Disabled

green anvilBOT
#

Yep — you disabled the legacy task (the one that runs C:\Users\mgt72\.openclaw\gateway.cmd). That’s fine to keep disabled.

What’s confusing is: OpenClaw is currently trying to manage the Gateway using a Scheduled Task named “OpenClaw Gateway”, and on your machine that name points to the legacy gateway.cmd task. So openclaw.cmd gateway start/restart is targeting the disabled legacy task → fails.

Best fix: reinstall the gateway service task (so it points at the new command)

Run:

openclaw.cmd gateway install

Then:

openclaw.cmd gateway start
openclaw.cmd gateway status --deep
#

This should recreate/repair the scheduled task so it runs the correct command (the ...node_modules\openclaw\dist\index.js gateway --port 18789 one).

If you need the gateway up immediately (workaround)

Run it in the foreground (keep the window open):

openclaw.cmd gateway --port 18789 --verbose

After it’s fixed

Once gateway status --deep shows “Service: Scheduled Task (registered)” with a command that includes dist\index.js, you can leave the old gateway.cmd task disabled (or delete it later).

If openclaw.cmd gateway install prints anything weird, paste its output here.

calm knoll
#

Gateway service already registered.

green anvilBOT
#

That message means: OpenClaw thinks the Windows “Gateway service” (Scheduled Task) already exists, so it didn’t recreate it.

But your actual task OpenClaw Gateway is currently:

  • Task To Run: C:\Users\mgt72\.openclaw\gateway.cmd
  • State: Disabled

…and openclaw.cmd gateway restart controls that task name, so restart/start will keep failing until we fix the task.

First: confirm whether the gateway is currently running anyway

Run:

openclaw.cmd gateway status --deep

If it shows Runtime: running + RPC probe: ok, you’re fine for the moment — we just need to fix the “service wiring” so restart works.

#

Fix options

Option A (quick + safe): re-enable the task so start/restart works again

schtasks /Change /TN "OpenClaw Gateway" /ENABLE
openclaw.cmd gateway start

This should stop the “task is disabled” error immediately.

Option B (cleanest): delete the legacy task and let OpenClaw recreate the correct one

This is the best long-term fix if that gateway.cmd task is the legacy one causing the “multiple gateways” warnings.

Before you do this: tell me if you’re OK deleting that scheduled task (it’s not your config/data, just the Windows autostart entry).

#

If yes, do:

openclaw.cmd gateway stop
schtasks /Delete /TN "OpenClaw Gateway" /F
openclaw.cmd gateway install
openclaw.cmd gateway start
openclaw.cmd gateway status --deep

After that, gateway status --deep should show the service command pointing at ...node_modules\openclaw\dist\index.js gateway ... (the modern one), and the “multiple gateways” warning should go away.


Paste your openclaw.cmd gateway status --deep output and I’ll tell you which option is safest for your current state.

calm knoll
#

Perfect, this is very helpful. Here’s what it means:

âś… Gateway is reachable
âś… Telegram is OK
⚠️ Gateway service is stopped (so stability/disconnect risk remains)
⚠️ Runtime still reports app 2026.2.14 (stale service wrapper)
Let’s fix both with a clean .cmd sequence:

openclaw gateway stop
taskkill /F /IM node.exe
del /f /q C:\Users\mgt72.openclaw\gateway.cmd
schtasks /Delete /TN "OpenClaw Gateway" /F
openclaw gateway start
openclaw status
What we want after this:

Gateway service ... running
app version updated from 2026.2.14 to current
If you run that now, paste the new openclaw status and I’ll confirm it’s fully clean.

green anvilBOT
#

Don’t run that sequence as-is.

  • taskkill /F /IM node.exe can kill other Node stuff on your machine (and can also kill the working gateway).
  • Deleting C:\Users\mgt72\.openclaw\gateway.cmd is unnecessary (and just makes the “legacy task” harder to inspect/cleanly remove).

The clean/safe way is to let OpenClaw re-register the gateway service properly:

openclaw.cmd gateway stop
openclaw.cmd gateway uninstall
openclaw.cmd gateway install --force --port 18789
openclaw.cmd gateway start
openclaw.cmd gateway status --deep

What you’re looking for in the final status output:

  • Service: Scheduled Task (registered)
#
  • Runtime: running
  • RPC probe: ok
  • And the Command should be the modern one that runs ...node_modules\openclaw\dist\index.js gateway ... (not ~\.openclaw\gateway.cmd)

If gateway uninstall / gateway install errors due to permissions (sometimes the legacy task is a “system” task), paste that error text and we’ll handle it (might just need running PowerShell “as Administrator” for the cleanup).

calm knoll
#

can you give me those commands one by one

green anvilBOT
#

Yep — run these one at a time (PowerShell), in this order. I’ll keep them in .cmd form.

1) Stop the gateway (safe)

openclaw.cmd gateway stop

2) Uninstall the current Scheduled Task service

openclaw.cmd gateway uninstall

3) Re-install the gateway service (force + correct port)

openclaw.cmd gateway install --force --port 18789
#

4) Start it

openclaw.cmd gateway start

5) Verify

openclaw.cmd gateway status --deep

If any step prints an error, paste that error before continuing to the next step (especially steps 2–3).

calm knoll
#

everytime I start the gateway it opens up for a second then closes do I close the original gateway I am using for that one?

green anvilBOT
#

If you ran openclaw.cmd gateway start: that gateway is supposed to run as a background Scheduled Task, so it’s normal to see a console window flash open for a second and then close.

The important question is: did the gateway stay running, or did it crash?

1) Don’t close the dashboard / “original gateway UI”

You don’t need to close your browser/dashboard. That’s just a client.

2) Do close/stop any foreground gateway you started manually

If you previously ran something like:

openclaw.cmd gateway --port 18789 --verbose

in a terminal, then yes you must stop that one first (Ctrl+C in that terminal, or openclaw.cmd gateway stop) before using the Scheduled Task version, otherwise you’ll get conflicts.

3) Check whether it’s actually running

Run this and paste the output:

#
openclaw.cmd gateway status --deep

You’re looking for:

  • Runtime: running
  • RPC probe: ok

4) If it says “stopped” (crash), grab the reason

Immediately run:

openclaw.cmd logs --follow

…and paste the last ~30 lines around where it stops/errors.

#

Once I see gateway status --deep + the log tail, I can tell you whether it’s just the normal “task window closes” behavior, or the gateway is actually exiting and why.

calm knoll
#

is /delete a bad thing what would it do

green anvilBOT
#

Depends what “/delete” you mean.

If you mean this from earlier:

schtasks /Delete /TN "OpenClaw Gateway" /F

That deletes the Windows Scheduled Task entry named “OpenClaw Gateway”.

  • It does not delete OpenClaw, your config, your API keys, or your sessions.
  • What it does do: removes the “run the Gateway in the background” autostart wiring.
  • After deleting it, openclaw.cmd gateway start/restart can stop working until you re-install the service with:
    openclaw.cmd gateway install --force --port 18789
    

So it’s not “bad”, but only do it if you’re intentionally cleaning up a duplicate/legacy task (and you’re ready to reinstall the correct one).

#

If you mean a Discord “/delete” slash command

That would just delete a Discord message (unrelated to your gateway).

Tell me the exact command text you’re looking at (or paste the full line), and I’ll confirm whether it’s safe in your specific case.

calm knoll
#

give me /delete in .cmd form I jsut want ti get rid fot he multiple gaetway message

green anvilBOT
#

There isn’t an “openclaw .cmd version” of that delete — it’s a Windows Scheduled Task command, so you run schtasks directly (works from PowerShell or cmd).

1) Double-check the task you’re deleting (should show ...\.openclaw\gateway.cmd)

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

2) Delete the legacy task (this is the “/Delete” you saw)

schtasks /Delete /TN "OpenClaw Gateway" /F

If it says access denied, re-run PowerShell as Administrator and run the same command again.

3) Verify the warning is gone

#
openclaw.cmd doctor --deep

4) Make sure your real gateway service still works

openclaw.cmd gateway status --deep

If after deleting you find openclaw.cmd gateway start/restart no longer works, you can recreate the service with:

openclaw.cmd gateway install --force --port 18789
openclaw.cmd gateway start
calm knoll
#

I deleted it now how do I check again

green anvilBOT
#

Run these to confirm the “extra gateway” is gone and your gateway still works:

1) Re-run doctor deep scan (this is the one that was warning you)

openclaw.cmd doctor --deep

You want it to NOT list “Other gateway-like services detected … \OpenClaw Gateway … gateway.cmd”.

2) Verify the gateway service + RPC probe is healthy

openclaw.cmd gateway status --deep

You want:

  • Runtime: running
  • RPC probe: ok

3) (Optional) Confirm only one listener on the port

#
netstat -ano | findstr :18789

Paste the output of doctor --deep if it still complains about multiple gateways.

calm knoll
#

Service: Scheduled Task (missing)
File logs: ~\AppData\Local\Temp\openclaw\openclaw-2026-03-02.log
Command: C:\Program Files\nodejs\node.exe C:\Users\mgt72\AppData\Roaming\npm\node_modules\openclaw\dist\index.js gateway --port 18789
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 (ERROR: The system cannot find the file specified.)
RPC probe: ok

Service unit not found.
Service not installed. Run: openclaw gateway install
File logs: C:\Users\mgt72\AppData\Local\Temp\openclaw\openclaw-2026-03-02.log

green anvilBOT
#

You’re in a good state: RPC probe: ok means a Gateway is currently running and reachable on ws://127.0.0.1:18789.

What broke is only the Windows “service” wrapper:

  • Service: Scheduled Task (missing) + Service not installed = you deleted the Scheduled Task, so openclaw gateway start/restart can’t manage it anymore.

Fix: re-install the Gateway service (Scheduled Task)

Run:

openclaw.cmd gateway install --force --port 18789

Then check:

#
openclaw.cmd gateway status --deep

If you want the service to be the one running right now

Since a gateway is already running on 18789, starting the service may fail due to the port already being in use.

To switch cleanly:

  1. Stop the currently-running gateway
  • If you have a terminal window where the gateway is running: press Ctrl+C there.

If you don’t know where it’s running, find its PID:

netstat -ano | findstr :18789
#

Take the PID from the LISTENING line, then:

taskkill /PID <PID> /F
  1. Start the service-managed gateway
openclaw.cmd gateway start
openclaw.cmd gateway status --deep

If you paste the output of netstat -ano | findstr :18789 again, I can tell you exactly which PID to kill (only that one).

calm knoll
#

it said gateway failed to start in the new terminal and then closed

green anvilBOT
#

That “opens a terminal for a second then closes” is normal for the Scheduled Task style gateway. The important part is why it says it failed (usually: the task didn’t get created, it’s disabled, or port 18789 is already in use by an already-running gateway).

Run these one by one and paste the output of each:

1) See what OpenClaw thinks is installed/running

openclaw.cmd gateway status --deep

2) Check whether the Scheduled Task exists (and is enabled)

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

3) Check if something is already using the gateway port (most common cause)

#
netstat -ano | findstr :18789
  • If you see a LISTENING PID there, that means something is already running on 18789, and the scheduled-task gateway can’t start.

If port 18789 is already in use

(Only do this after you’ve pasted the netstat output OR you’re confident which PID is the gateway.)

Kill just the PID that’s LISTENING on 18789:

taskkill /PID <PID_FROM_NETSTAT> /F

Then try starting the service again:

#
openclaw.cmd gateway start
openclaw.cmd gateway status --deep

If the Scheduled Task is missing

Reinstall it:

openclaw.cmd gateway install --force --port 18789

Then:

openclaw.cmd gateway start
openclaw.cmd gateway status --deep
#

Paste outputs from steps 1–3 and I’ll tell you exactly which branch you’re in (task missing vs port conflict vs disabled task).

calm knoll
#

does it hurt I have the openclaw control dashboard page on

green anvilBOT
#

No — it doesn’t hurt.

The Control Dashboard is just a web page client talking to the gateway at http://127.0.0.1:18789/. Leaving it open won’t cause the “multiple gateway” issue.

The only time it’s “in the way” is:

  • if the gateway is restarting, the page may show disconnect/reconnect messages, and
  • it can keep one connection open (you’ll see an ESTABLISHED line in netstat), but that doesn’t block the port.

So you can leave it open while we fix the service/startup.

Next step: run and paste

netstat -ano | findstr :18789

so we can see if something is already listening on the gateway port.

calm knoll
#

Service is loaded but not running (likely exited immediately).
File logs: C:\Users\mgt72\AppData\Local\Temp\openclaw\openclaw-2026-03-02.log
Logs: schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

green anvilBOT
#

That message means the Scheduled Task exists, but when Windows tries to run it, the Gateway exits immediately. Next step is: check the task’s last-run result + the log file.

Run these one by one and paste the output:

1) See the Scheduled Task details (most important)

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

You’re looking for:

  • Task To Run (what command it’s actually executing)
  • Last Run Time
  • Last Result (error code)

2) Check if port 18789 is already taken (common cause)

netstat -ano | findstr :18789
#

If you see a LISTENING PID on :18789, the service can’t start because something is already running there.

3) Show the last ~200 lines of the gateway log

Get-Content -Tail 200 C:\Users\mgt72\AppData\Local\Temp\openclaw\openclaw-2026-03-02.log

Once you paste those, I’ll tell you exactly what to do next.

(If it is a port conflict, we’ll kill only the PID that’s listening on 18789—after confirming what process it is.)

calm knoll
#

{"0":"{"subsystem":"agent/embedded"}","1":"embedded run prompt end: runId=b0abfd6a-4266-4c1b-b8c1-4e339b5051ba sessionId=cea4c607-bf37-4cda-b3c8-00f2c0764338 durationMs=6870","_meta":{"runtime":"node","runtimeVersion":"24.13.1","hostname":"MGT","name":"{"subsystem":"agent/embedded"}","parentNames":["openclaw"],"date":"2026-03-02T20:53:24.807Z","logLevelId":2,"logLevelName":"DEBUG","path":{"fullFilePath":"file:///C:/Users/mgt72/AppData/Roaming/npm/node_modules/openclaw/dist/subsystem-DypCPrmP.js:1170:14","fileName":"subsystem-DypCPrmP.js","fileNameWithLine":"subsystem-DypCPrmP.js:1170","fileColumn":"14","fileLine":"1170","filePath":"/C:/Users/mgt72/AppData/Roaming/npm/node_modules/openclaw/dist/subsystem-DypCPrmP.js","filePathWithLine":"/C:/Users/mgt72/AppData/Roaming/npm/node_modules/openclaw/dist/subsystem-DypCPrmP.js:1170","method":"logToFile"}},"time":"2026-03-02T20:53:24.808Z"}
{"0":"{"subsystem":"diagnostic"}","1":"run cleared: sessionId=cea4c607-bf37-4cda-b3c8-00f2c0764338 totalActive=0","_meta":{"runtime":"node","runtimeVersion":"24.13.1","hostname":"MGT","name":"{"subsystem":"diagnostic"}","parentNames":["openclaw"],"date":"2026-03-02T20:53:24.809Z","logLevelId":2,"logLevelName":"DEBUG","path":{"fullFilePath":"file:///C:/Users/mgt72/AppData/Roaming/npm/node_modules/openclaw/dist/subsystem-DypCPrmP.js:1170:14","fileName":"subsystem-DypCPrmP.js","fileNameWithLine":"subsystem-DypCPrmP.js:1170","fileColumn":"14","fileLine":"1170","filePath":"/C:/Users/mgt72/AppData/Roaming/npm/node_modules/openclaw/dist/subsystem-DypCPrmP.js","filePathWithLine":"/C:/Users/mgt72/AppData/Roaming/npm/node_modules/openclaw/dist/subsystem-DypCPrmP.js:1170","method":"logToFile"}},"time":"2026-03-02T20:53:24.809Z"}
{"0":"{"subsystem":"agent/embedded"}","1":"embedded run done: runId=b0abfd6a-4266-4c1b-b8c1-4e339b5051ba sessionId=cea4c607-bf37-4cda-b3c8-0

green anvilBOT
#

Those log lines you pasted are just “embedded run done” debug noise — they don’t show the Scheduled Task failure reason yet.

To figure out why the Gateway service starts then immediately exits, we need two things:

1) Show the Scheduled Task “Last Result” + what it runs

Run this and paste the output:

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

Key fields I’m looking for in what you paste:

  • Task To Run
  • Last Run Time
  • Last Result (this is the error code)

2) Check if the port is already taken (most common cause)

#

Run and paste:

netstat -ano | findstr :18789

If there’s a LISTENING PID on :18789, the Scheduled Task gateway can’t start (it will exit immediately).

3) Get the error part of the gateway log (not debug)

Run and paste:

Get-Content -Tail 200 C:\Users\mgt72\AppData\Local\Temp\openclaw\openclaw-2026-03-02.log

Once you paste (1)+(2)+(3), I can tell you exactly which fix applies (port conflict vs bad Task To Run path vs permissions/config path issue).

calm knoll
#

Status: Ready
Logon Mode: Interactive only
Last Run Time: 3/2/2026 4:10:18 PM
Last Result: 1
Author: MGT\mgt72
Task To Run: C:\Users\mgt72.openclaw\gateway.cmd
Start In: N/A
Comment: N/A
Scheduled Task State: Enabled
Idle Time: Disabled
Power Management: Stop On Battery Mode, No Start On Batteries
Run As User: mgt72
Delete Task If Not Rescheduled: Disabled
Stop Task If Runs X Hours and X Mins: 72:00:00
Schedule: Scheduling data is not available in this format.

green anvilBOT
#

That output tells us exactly what’s going on:

  • Your Scheduled Task is enabled, but it still runs the legacy wrapper:
    Task To Run: C:\Users\mgt72\.openclaw\gateway.cmd
  • It tried to run and exited with code 1 (Last Result: 1), so the window flashes and closes.

Most common reason for that on Windows: port 18789 is already in use by another gateway that’s still running, so the scheduled-task gateway starts, can’t bind, and immediately exits.

Next step (run just this one command and paste the output)

netstat -ano | findstr :18789

What I’m looking for:

  • a LISTENING line on :18789 and its PID (last column).

After you paste it, I’ll tell you the exact next command (usually tasklist to identify the PID, then taskkill /PID <pid> /F to free the port, then openclaw.cmd gateway start).

calm knoll
#

TCP 127.0.0.1:18789 0.0.0.0:0 LISTENING 60168
TCP 127.0.0.1:18789 127.0.0.1:60207 ESTABLISHED 60168
TCP 127.0.0.1:60207 127.0.0.1:18789 ESTABLISHED 50912
TCP [::1]:18789 [::]:0 LISTENING 60168

green anvilBOT
#

That netstat output is the smoking gun:

127.0.0.1:18789 LISTENING 60168

So something is already running on the gateway port. That’s why when you “start the gateway service” it pops open for a second and closes — it tries to start, can’t bind to 18789, and exits.

Do this one step at a time:

1) Identify what PID 60168 is

tasklist /FI "PID eq 60168"

2) If it shows node.exe (very likely the old/foreground gateway), stop just that PID

taskkill /PID 60168 /F
#

3) Now start the gateway service again

openclaw.cmd gateway start

4) Verify it stayed up

openclaw.cmd gateway status --deep

You want Runtime: running and RPC probe: ok.

(And no, having the Control Dashboard page open does not hurt. It doesn’t “take the port”; only the gateway process does.)

calm knoll
#

it worked

green anvilBOT
#

Good — that confirms it was a port conflict (PID 60168 was already holding :18789, so the scheduled-task gateway couldn’t start).

To make sure you’re fully “clean” now, run:

openclaw.cmd gateway status --deep

You want:

  • Service: Scheduled Task (registered)
  • Runtime: running
  • RPC probe: ok

Prevention going forward (so this doesn’t happen again):

  • Don’t run openclaw.cmd gateway --port 18789 ... in a terminal and also use openclaw.cmd gateway start (service) — pick one. On Windows, the Scheduled Task/service is easiest.
  • If you need to restart: use openclaw.cmd gateway restart (not starting extra terminals).
#

If this fixed it, please mark the solution in Discord (right-click the solution message → Apps → ✅ Mark Solution) so Answer Overflow can index it.

calm knoll
#

I am still getting this Listening: 127.0.0.1:18789
Other gateway-like services detected (best effort):

  • \OpenClaw Gateway (system, task: \OpenClaw Gateway, run: C:\Users\mgt72.openclaw\gateway.cmd)
    Cleanup hint: schtasks /Delete /TN "OpenClaw Gateway" /F

Recommendation: run a single gateway per machine for most setups. One gateway supports multiple agents (see docs: /gateway#multiple-gateways-same-host).
If you need multiple gateways (e.g., a rescue bot on the same host), isolate ports + config/state (see docs: /gateway#multiple-gateways-same-host). - but my openclaw control updated to 2026.3.1 in the top right

green anvilBOT
#

Good — if the Control UI top-right now shows 2026.3.1, you’re on the right Gateway.

That leftover message:

“Other gateway-like services detected … \OpenClaw Gateway (system) … gateway.cmd”

means there’s still a second Scheduled Task definition on your machine (system-level). It’s not necessarily running anymore — OpenClaw is just warning that it exists and could start later.

Option 1 (recommended): ignore it

If everything works now (dashboard + Telegram), you can ignore that warning. It’s just “cleanup advice”.

Option 2: remove the warning by deleting the leftover system task

This usually requires an Administrator PowerShell.

  1. First, confirm it’s the leftover one:
#
schtasks /Query /TN "\OpenClaw Gateway" /V /FO LIST

If it says Task To Run: C:\Users\mgt72\.openclaw\gateway.cmd, that’s the one OpenClaw is complaining about.

  1. Delete it (run PowerShell “as Administrator” if needed):
schtasks /Delete /TN "\OpenClaw Gateway" /F
  1. Check again:
openclaw.cmd gateway status --deep

If deleting it makes OpenClaw say “service missing”, just reinstall the service:

#
openclaw.cmd gateway install --force --port 18789
openclaw.cmd gateway start

If you paste the output of the schtasks /Query ... step, I can tell you 100% whether it’s safe to delete (i.e., it’s not the task that’s currently running your working gateway).

calm knoll
#

Do i need to keep these terminals open all the time

green anvilBOT
#

No — not if you’re running the Gateway as a Scheduled Task service (which you are now).

  • If you start it with openclaw.cmd gateway start, Windows runs it in the background. You can close the terminals.
  • You only need a terminal open if you’re running it in the foreground with something like:
    openclaw.cmd gateway --port 18789 --verbose
    
    (that mode dies when you close the window)

Quick check:

openclaw.cmd gateway status --deep

If it says Service: Scheduled Task and Runtime: running, you’re good to close terminals.

Tip: when you want to restart later, just do:

#
openclaw.cmd gateway restart
calm knoll
#

can you summarize everyhting we went over for my notes go over all the .cmd commands etc

green anvilBOT
#

Here’s a clean “notes” summary of what happened + the useful .cmd commands.


What was going wrong

1) PowerShell blocked openclaw (ExecutionPolicy)

You saw:

openclaw.ps1 cannot be loaded because running scripts is disabled…

Fix/workaround: use the .cmd shim:

  • openclaw.cmd ... works even when .ps1 is blocked.

(Optional permanent fix: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned.)

2) Gateway disconnects were mostly “two gateways fighting”

On Windows you can end up with:

#
  • a service/daemon gateway (Scheduled Task), and/or
  • a manual foreground gateway started from a terminal

If both try to use port 18789, one will fail and you get disconnects / weird version mismatches.

3) “Gateway window flashes then closes”

That’s normal when starting a Scheduled Task, unless it’s failing immediately. In your case it failed because port 18789 was already in use.

4) “Multiple gateway-like services detected”

That message means Windows had extra Scheduled Tasks left over (legacy gateway.cmd tasks). Not always “running”, but they can cause trouble later.


The commands we used (copy/paste friendly)

A) Basic health checks

#
openclaw.cmd --version
openclaw.cmd gateway status
openclaw.cmd gateway status --deep
openclaw.cmd logs --follow
openclaw.cmd doctor
openclaw.cmd doctor --deep

B) Start/stop/restart the gateway (service-managed)

openclaw.cmd gateway start
openclaw.cmd gateway stop
openclaw.cmd gateway restart

C) Run gateway in the foreground (only if you want a terminal-run gateway)

#

(You must keep the terminal open.)

openclaw.cmd gateway --port 18789 --verbose

D) Check if the gateway port is already taken (port conflict)

netstat -ano | findstr :18789

Find the PID on the LISTENING line, then identify it:

tasklist /FI "PID eq <PID>"

Kill ONLY that PID if needed (this is what fixed it for you):

#
taskkill /PID <PID> /F

E) Scheduled Task (Gateway service) inspection / cleanup

Check the task:

schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST

Enable it if it got disabled:

schtasks /Change /TN "OpenClaw Gateway" /ENABLE

Stop a running scheduled task:

#
schtasks /End /TN "OpenClaw Gateway"

Delete the legacy/duplicate task (what you used to remove the “multiple gateway” warning):

schtasks /Delete /TN "OpenClaw Gateway" /F

F) Doctor repairs / migrations

When doctor said “apply changes”:

openclaw.cmd doctor --fix

Doctor also prompted about:

  • legacy state migration → answer YES
#
  • archiving orphan transcripts → answer YES (it archives as .deleted.<timestamp>, not a hard delete)

What you learned / “rules of thumb”

  1. On Windows, prefer one gateway (Scheduled Task / service) and manage it with:

    • openclaw.cmd gateway restart
  2. If gateway won’t start and flashes closed: check port conflict:

    • netstat -ano | findstr :18789
  3. If you get “multiple gateway-like services detected”: it usually means old Scheduled Tasks exist.

    • Inspect with schtasks /Query ...
    • Disable/delete the legacy one (usually the one running C:\Users\<you>\.openclaw\gateway.cmd)
  4. You do not need to keep terminals open if the gateway is running as a Scheduled Task.