Skip to content

tools.exec.pathPrepend replaces PATH entirely on Windows instead of prepending #25399

@Stache73

Description

@Stache73

Bug: tools.exec.pathPrepend replaces PATH entirely instead of prepending

Platform: Windows 10 (22H2), node v24.6.0, OpenClaw v2026.2.23 (b817600)
Shell: PowerShell

Expected behaviour

Setting tools.exec.pathPrepend should prepend the specified directories to the existing system PATH, making those directories available alongside all existing PATH entries.

Actual behaviour

The specified directories replace the entire PATH. After applying this config and restarting, the exec shell PATH contains only the prepended value — all standard system directories are gone.

Steps to reproduce

  1. Apply config: tools.exec.pathPrepend: ["C:\\Users\\username\\AppData\\Roaming\\npm"]
  2. Restart gateway
  3. Run any exec command: powershell Get-Date

Result:

powershell: The term 'powershell' is not recognized as the name of a cmdlet, function, script file, or operable program.

Verified by running echo $env:PATH inside exec — output was only C:\Users\arvid\AppData\Roaming\npm. All of C:\Windows\System32, C:\Windows, and every other system directory were absent.

Impact

Setting this config key renders the exec tool completely non-functional. powershell, where.exe, gh, and all other system commands disappear from PATH. No exec commands can run at all. The only recovery is to remove the key from openclaw.json directly and manually restart the gateway.

Workaround

Do not use tools.exec.pathPrepend. Reference executables via full absolute path when needed (e.g. C:\Users\username\AppData\Roaming\npm\openclaw.cmd).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions