Skip to content

Windows: openclaw gateway restart does not stop existing gateway process before spawning new one #27802

@marcmy

Description

@marcmy

Summary

On Windows, openclaw gateway restart fails on my setup because the currently running gateway process is not stopped before restart launches a new process.

Steps to reproduce

  1. Start gateway (e.g., openclaw gateway start).
  2. Confirm gateway is running in its terminal window.
  3. Run openclaw gateway restart.
  4. Observe original gateway terminal/process remains running.
  5. Restart opens a new gateway process, which then fails because port 18789 is already in use.

Expected behavior

openclaw gateway restart should stop the existing gateway process, wait for confirmed exit, then start exactly one new gateway process.

Actual behavior

Original gateway process/terminal stays alive after restart command. A new process is launched and fails due to port conflict with the still-running original process.

Important additional note

This is not only a restart problem. On my setup, openclaw gateway stop also fails to stop the running gateway process (without workaround), which contributes to restart failures.

OpenClaw version

2026.2.25-beta.1

Operating system

Windows 11

Install method

npm global install

Logs, screenshots, and evidence

2026-02-26T12:37:00.412-05:00 error Gateway failed to start: gateway already running (pid 42812); lock timeout after 5000ms
If the gateway is supervised, stop it with: openclaw gateway stop
2026-02-26T12:37:00.540-05:00 error Port 18789 is already in use.
2026-02-26T12:37:00.542-05:00 error - pid 42812: "C:\Program Files\nodejs\node.exe" C:\Users\marcm\AppData\Roaming\npm\node_modules\openclaw\dist\index.js gateway --port 18789 (127.0.0.1:18789)
2026-02-26T12:37:00.543-05:00 error - Gateway already running locally. Stop it (openclaw gateway stop) or use a different port.
2026-02-26T12:37:00.777-05:00 error Gateway service appears registered. Stop it first.
2026-02-26T12:37:00.779-05:00 error Tip: openclaw gateway stop
2026-02-26T12:37:00.780-05:00 error Or: schtasks /End /TN "OpenClaw Gateway"

Impact and severity

Frequency: 100% reproducible without workaround (always).

Additional information

Workaround commands currently used:

for /f "tokens=5" %%P in ('netstat -ano ^| findstr /R /C:":%OPENCLAW_GATEWAY_PORT% .*LISTENING"') do (
taskkill /PID %%P /F >nul 2>nul
)
timeout /t 1 /nobreak >nul

Then launch gateway normally:

"C:\Program Files\nodejs\node.exe" C:\Users\marcm\AppData\Roaming\npm\node_modules\openclaw\dist\index.js gateway --port %OPENCLAW_GATEWAY_PORT%

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions