Windows: `npm run dev` Bad Gateway — Vite exits with `C:\Program` path error
#715 opened on May 21, 2026
Repository metrics
- Stars
- (43 stars)
- PR merge metrics
- (Avg merge 2d 10h) (106 merged PRs in 30d)
Description
Bug
On Windows, npm run dev starts the agent-server, automation backend, and ingress proxy successfully, but the UI at http://localhost:8000/ returns Bad Gateway because Vite exits immediately.
[vite] Starting on port 3001...
[vite] 'C:\Program' is not recognized as an internal or external command,
[vite] operable program or batch file.
[vite] Exited with code 1
[ingress] Proxy error for /:
The ingress proxy's default route targets http://localhost:3001. With Vite dead, requests to / fail.
Root Cause
A path under C:\Program Files\... is invoked through a Windows shell without quoting, causing cmd.exe to execute C:\Program instead of the full path.
Workarounds
Bypass the npm wrapper (Vite dev mode):
$env:PYTHONUTF8 = "1"
node --env-file-if-exists=.env .\scripts\dev-with-automation.mjs
Use the static frontend launcher:
$env:PYTHONUTF8 = "1"
node --env-file-if-exists=.env .\scripts\dev-static.mjs
# Skip rebuild after first build:
node --env-file-if-exists=.env .\scripts\dev-static.mjs --skip-build
Fix
In spawnService(), avoid spawning frontend commands through cmd.exe when the command path may contain spaces — either quote the path or set shell: false for Node/npm script invocations on Windows.
This issue was created by an AI agent (OpenHands) on behalf of the user.