Skip to content

openclaw_supervisor.ps1: unquoted paths break on Windows usernames with spaces #47484

@omerliran

Description

@omerliran

Bug

The auto-generated openclaw_supervisor.ps1 passes .cmd file paths to cmd.exe /c without quoting them. On any Windows machine where %USERPROFILE% contains a space (e.g. C:\Users\John Smith), the supervisor cannot restart the gateway or node host after a crash.

Reproduction

  1. Install OpenClaw on Windows with a username containing a space (e.g. "John Smith")
  2. Let the gateway or node host crash (or kill the process)
  3. The supervisor fails to restart either service

Error in logs/node.err.log and logs/gateway.err.log:

'C:\Users\John' is not recognized as an internal or external command,
operable program or batch file.

Root cause

In openclaw_supervisor.ps1, the Start-Process calls pass the .cmd path unquoted:

# Line ~118
$startGateway = {
    Start-Process -FilePath "cmd.exe" `
      -ArgumentList @("/c", $gatewayCmd) `   # <-- $gatewayCmd is NOT quoted
      ...
}

# Line ~127
$startNode = {
    Start-Process -FilePath "cmd.exe" `
      -ArgumentList @("/c", $nodeCmd) `      # <-- $nodeCmd is NOT quoted
      ...
}

When $gatewayCmd resolves to C:\Users\John Smith\.openclaw\gateway.cmd, cmd.exe interprets C:\Users\John as the command and Smith\.openclaw\gateway.cmd as an argument.

Fix

Wrap the path in escaped double quotes:

-ArgumentList @("/c", "`"$gatewayCmd`"")
-ArgumentList @("/c", "`"$nodeCmd`"")

Impact

  • The scheduled tasks ("OpenClaw Gateway" / "OpenClaw Node") work fine at logon because their Task To Run paths are quoted
  • The supervisor is the only recovery mechanism for mid-session crashes, so this bug means any crash is permanent until the next logon
  • Affects any Windows user with a space in their username (very common)

Environment

  • Windows 11 Pro
  • OpenClaw 2026.3.13
  • Node.js v22.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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