solution gateway high windows

Windows: tools.exec cannot find docker, rg, or gh even though they work in PowerShell

Fix native Windows cases where the Scheduled Task gateway uses a different PATH than your interactive shell, so tools.exec cannot resolve installed CLI tools.

By CoClaw Team •

Symptoms

  • In PowerShell, where docker, where rg, or where gh succeeds.
  • But inside OpenClaw tools.exec, those commands behave like they are missing.
  • Plugin runtime setup may fail with follow-on errors like:
    • npm is required to install plugin-local ... but was not found on PATH
  • The problem appears only when the gateway runs as a Windows Scheduled Task.

Cause

On native Windows, the gateway service does not necessarily see the same PATH as your interactive shell.

The built-in daemon path launches through a generated wrapper such as:

%USERPROFILE%\.openclaw\gateway.cmd

So you can end up debugging a service-environment PATH mismatch, not a missing installation of docker, rg, gh, or npm.

Fix

1) Reinstall the gateway from the same shell where the commands already work

In the exact shell where these succeed:

where docker
where rg
where gh

reinstall the gateway:

openclaw gateway stop
openclaw gateway uninstall
openclaw gateway install --force --runtime node --port 18789

2) Inspect gateway.cmd, but do not treat it as durable configuration

Open:

%USERPROFILE%\.openclaw\gateway.cmd

Use it to confirm what PATH and command the Scheduled Task will actually run.

Important: this file is useful for diagnosis, but updates and reinstalls can regenerate it. Do not rely on hand-edited lines there as your long-term fix.

3) If exec really runs on the gateway, use tools.exec.pathPrepend carefully

For gateway-host exec, this can be the right fix:

{
  tools: {
    exec: {
      pathPrepend: [
        "C:\\Program Files\\Docker\\Docker\\resources\\bin",
        "C:\\Users\\<you>\\AppData\\Local\\Microsoft\\WinGet\\Links"
      ]
    }
  }
}

Then restart the gateway:

openclaw gateway restart

4) If enabling pathPrepend makes PATH worse, remove it immediately

Some Windows issue reports have shown tools.exec.pathPrepend behaving badly enough to effectively break PATH resolution.

If even powershell or where.exe disappears inside exec after enabling it:

  • remove tools.exec.pathPrepend from config,
  • restart the gateway,
  • fall back to full executable paths,
  • or run the gateway in the foreground while debugging.

5) Use foreground gateway as the clean control test

openclaw gateway run --port 18789

If the commands work in foreground mode but fail under Scheduled Task, you have confirmed this is a Windows service-environment problem.

Verify

  • In the same PowerShell used for install, where docker, where rg, or where gh succeeds.
  • tools.exec can run the same command in a fresh session.
  • If you used foreground gateway run, the command also works there.

Verification & references

  • Reviewed by:CoClaw Editorial Team
  • Last reviewed:March 14, 2026
  • Verified on: Windows
Want to explore more? Browse all solutions or ask in the Community Forum .
Report a problem

Related Resources

Windows: Gateway service fails to start when the user profile path is non-ASCII
Fix
Fix cases where `openclaw gateway start` works in the foreground but exits immediately when launched via Scheduled Task because the command path includes non-ASCII characters.
Windows: Exec tool returns empty output unless pty: true
Fix
Work around a Windows regression where non-PTY exec produces no output or side effects by forcing PTY and (optionally) capturing clean output via a temp file.
OpenClaw only chats and won't use tools after update
Fix
Fix OpenClaw when it suddenly stops reading files, patching code, or running commands after a recent update. The most common cause is `tools.profile: messaging` or a narrower tool policy.
Windows: 'openclaw' is not recognized after install
Fix
Fix Windows PATH issues after installing OpenClaw globally (npm prefix not on PATH, terminal not restarted, or multiple Node installs).
OpenClaw on Native Windows: PATH, Scheduled Tasks, Node Host, and the Real Failure Modes
Guide
A field guide to running OpenClaw on native Windows without guesswork. Learn why shell PATH and Scheduled Task PATH diverge, when `tools.exec.pathPrepend` helps or hurts, why `openclaw node run` can stall after printing PATH, and when WSL2 is the lower-risk choice.
OpenClaw on Windows: Native vs WSL2, Install Paths, and When to Switch
Guide
A practical decision guide for Windows users: when native Windows is good enough, when WSL2 is the safer default, which install path to choose, and how to migrate without turning your setup into a mystery.