Skip to content

[BUG] Browser does not launch on Windows #1376

@1827marketing

Description

@1827marketing

What version of eigent are you using?

0.0.85

System information

Windows 11

Problem description

Summary

On Windows (packaged Desktop App), the backend endpoint that opens the Electron “login browser” can fail with:

FileNotFoundError: [WinError 2] The system cannot find the file specified even when npx works in an interactive terminal.

Symptoms / logs

Backend logs show it attempting to launch:

Electron args: ['npx', 'electron', ... 'electron_browser.cjs', ...] and then failing at subprocess.Popen(...) / Windows CreateProcess with [WinError 2].

Root cause (likely)

open_browser_login() in backend/app/controller/tool_controller.py invokes npx by name:

subprocess.Popen(["npx", "electron", ...])

In the packaged app context, the backend process environment may not inherit the user’s PATH as expected (and Windows process creation uses CreateProcess resolution, not PowerShell command resolution). As a result, npx may be unavailable even though it’s present/working in a user shell.

This is especially brittle on Windows because:

  • PowerShell can resolve npx differently (e.g., npx.ps1) than CreateProcess can.
  • A packaged Electron app may run with a different environment than an interactive terminal.
  • Eigent already appears to provide an internal wrapper at ~/.eigent/bin/npx.cmd, but the backend doesn’t use it explicitly.

log

PS C:\Users\IanKirk> C:\Users\IanKirk\AppData\Local\Programs\Eigent\Eigent.exe
PS C:\Users\IanKirk>
08:39:20.657 > [PROXY] No proxy configured
try port 9222

DevTools listening on ws://127.0.0.1:9222/devtools/browser/bf4847cc-44a3-4faa-88cb-d63f79d7e40d
[info] [MAIN] Waiting for profile initialization...
[info] [CDP BROWSER] Created CDP profile directory at C:\Users\IanKirk.eigent\browser_profiles\cdp_profile_9222
[info] [CDP BROWSER] Chrome DevTools Protocol enabled on port 9222
[info] [CDP BROWSER] CDP profile directory: C:\Users\IanKirk.eigent\browser_profiles\cdp_profile_9222
[info] [STORAGE] Main app userData: C:\Users\IanKirk\AppData\Roaming\eigent
[info] [MAIN] Profile initialization completed
[info] [ANTI-FINGERPRINT] User Agent set for all sessions
[info] [PROTOCOL] Registered localfile protocol on both default and main_window sessions
[info] .eigent directory structure ensured
[info] Seeded default skills to ~/.eigent/skills from C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\example-skills
[info] [PROJECT BROWSER WINDOW] Creating BrowserWindow which will start Chrome with CDP on port 9222
[info] [PROJECT BROWSER WINDOW] Current user data path: C:\Users\IanKirk\AppData\Roaming\eigent
[info] [PROJECT BROWSER WINDOW] Command line switch user-data-dir: C:\Users\IanKirk.eigent\browser_profiles\cdp_profile_9222
[info] [COOKIE SYNC] No tool_controller partition found, WebView will start fresh
[info] [PROJECT BROWSER] Creating WebViews with partition: persist:user_login
[info] [PROJECT BROWSER] WebViewManager initialized with webviews
Current version: 0.0.85
Update config path: undefined
User data path (where config lives): C:\Users\IanKirk\AppData\Roaming\eigent
Checking for update
[info] Pre-checking if dependencies need to be installed...
[info] [PRE-CHECK] Prebuilt dependencies found, skipping installation check
[info] Using prebuilt binary: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\bin\uv.exe
[info] Using prebuilt binary: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\bin\bun.exe
[info] Installation check result: {
needsInstallation: false,
versionExists: true,
versionMatch: true,
uvExists: true,
bunExists: true,
installationCompleted: false,
venvExists: true,
venvPath: 'C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\venv'
}
[info] Installation already complete - letting useInstallationSetup handle state transitions
Update for version 0.0.85 is not available (latest version: 0.0.85, downgrade is disallowed).
checkForUpdatesAndNotify called, downloadPromise is null
[info] Window content loaded, starting dependency check immediately...
[info] Window shown after content loaded
[info] Window is ready, processing queued protocol URLs...
Checking for update
[info] Using prebuilt binary: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\bin\uv.exe
[info] Using prebuilt binary: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\bin\bun.exe
Update for version 0.0.85 is not available (latest version: 0.0.85, downgrade is disallowed).
checkForUpdatesAndNotify called, downloadPromise is null
[info] [DEPS INSTALL] Prebuilt dependencies found, skipping installation
[info] [DEPS INSTALL] Using prebuilt dependencies, creating version file
[info] [DEPS INSTALL] version file updated { currentVersion: '0.0.85' }
[info] [DEPS INSTALL] Using prebuilt terminal venv: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\terminal_venv
[info] [DEPS INSTALL] Dependency Success: Using prebuilt dependencies
[info] [DEPS INSTALL] Sent install-dependencies-complete event to frontend
[info] [DEPS INSTALL] Starting backend...
[info] Checking and starting backend service...
[info] Using prebuilt binary: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\bin\uv.exe
[info] Using prebuilt binary: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\bin\bun.exe
[info] Tool installed, starting backend service...
start fastapi
[info] Using prebuilt binary: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\bin\uv.exe
[info] [VENV] Created uv_python symlink: C:\Users\IanKirk.eigent\uv_python
[info] [VENV] Backend venv already at C:\Users\IanKirk.eigent\venvs\backend-0.0.85 (v0.0.85)
userData C:\Users\IanKirk\AppData\Roaming\eigent
Using venv path: C:\Users\IanKirk.eigent\venvs\backend-0.0.85
try port 5001
[info] Found available port: 5001
[info] Backend service started successfully { port: 5001 }
[info] [VENV] Using prebuilt Python: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\uv_python
[info] [VENV] Backend venv already at C:\Users\IanKirk.eigent\venvs\backend-0.0.85 (v0.0.85)
[info] Backend SERVER_URL resolved to: https://dev.eigent.ai/api (source: default)
[info] [VENV] Terminal venv already at C:\Users\IanKirk.eigent\venvs\terminal_base-0.0.85 (v0.0.85)
[info] Spawning backend process: C:\Users\IanKirk.eigent\venvs\backend-0.0.85\Scripts\python.exe -m uvicorn main:api --port 5001 --loop asyncio
[info] Backend working directory: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\backend
[info] Python test output: Python OK
[info] Backend process spawned with PID: 18140
[info] Backend process still running after 1s with PID 18140
[info] Starting backend health check polling...
[info] BACKEND: 2026-02-26 08:39:29,902 - main - INFO - Starting Eigent Multi-Agent System API
2026-02-26 08:39:29,902 - main - INFO - Python encoding: utf-8
2026-02-26 08:39:29,902 - main - INFO - Environment: development
[info] BACKEND: 2026-02-26 08:39:29,902 - main - INFO - Loading routers with prefix: ''
2026-02-26 08:39:29,903 - router - INFO - Registered Health router: 1 routes - Health check endpoint for service readiness
[info] BACKEND: 2026-02-26 08:39:29,913 - router - INFO - Registered chat router: 9 routes - Chat session management, improvements, and human interactions
[info] BACKEND: 2026-02-26 08:39:29,918 - router - INFO - Registered model router: 1 routes - Model validation and configuration
[info] BACKEND: 2026-02-26 08:39:29,918 - router - INFO - Registered task router: 5 routes - Task lifecycle management (start, stop, update, control)
[info] BACKEND: 2026-02-26 08:39:29,925 - router - INFO - Registered tool router: 12 routes - Tool installation and management
2026-02-26 08:39:29,925 - router - INFO - Total routers registered: 5
2026-02-26 08:39:29,925 - main - INFO - All routers loaded successfully
[info] BACKEND: 2026-02-26 08:39:29,927 - main - INFO - Application initialization completed successfully
INFO: Started server process [2688]
INFO: Waiting for application startup.
[info] BACKEND: 2026-02-26 08:39:29,927 - main - INFO - PID write task created
2026-02-26 08:39:29,927 - app.utils.telemetry.workforce_metrics - INFO - Langfuse credentials not found, telemetry disabled
2026-02-26 08:39:29,927 - main - INFO - Telemetry tracer provider initialized
[info] BACKEND: INFO: Application startup complete.
[info] BACKEND: INFO: Uvicorn running on http://127.0.0.1:5001 (Press CTRL+C to quit)
[info] BACKEND: 2026-02-26 08:39:29,941 - main - INFO - PID file written: 2688
[info] Backend health check passed after 12 attempts
[info] Backend is ready, notifying frontend...
[info] BACKEND: 2026-02-26 08:39:41,709 - tool_controller - INFO - [COOKIES CHECK] Tool controller user_data_dir: C:\Users\IanKirk/.eigent/browser_profiles\profile_user_login
[info] BACKEND: 2026-02-26 08:39:58,365 - tool_controller - INFO - Creating browser session user_login with profile at: C:\Users\IanKirk/.eigent/browser_profiles\profile_user_login
[info] BACKEND: 2026-02-26 08:40:00,420 - tool_controller - INFO - [PROFILE USER LOGIN] Launching Electron browser with CDP on port 9223
2026-02-26 08:40:00,420 - tool_controller - INFO - [PROFILE USER LOGIN] Working directory: C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources
[info] BACKEND: 2026-02-26 08:40:00,420 - tool_controller - INFO - [PROFILE USER LOGIN] userData path: C:\Users\IanKirk/.eigent/browser_profiles\profile_user_login
2026-02-26 08:40:00,422 - tool_controller - INFO - [PROFILE USER LOGIN] Electron args: ['npx', 'electron', 'C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\backend\app\controller\electron_browser.cjs', 'C:\Users\IanKirk/.eigent/browser_profiles\profile_user_login', '9223', 'https://www.google.com']
[error] BACKEND: 2026-02-26 08:40:00,429 - tool_controller - ERROR - Failed to open Electron browser for login: [WinError 2] The system cannot find the file specified
Traceback (most recent call last):
File "C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\backend\app\controller\tool_controller.py", line 740, in open_browser_login
process = subprocess.Popen(
^^^^^^^^^^^^^^^^^
File "C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\uv_python\cpython-3.11.11-windows-x86_64-none\Lib\subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\IanKirk\AppData\Local\Programs\Eigent\resources\prebuilt\uv_python\cpython-3.11.11-windows-x86_64-none\Lib\subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
[info] BACKEND: 2026-02-26 08:40:00,970 - tool_controller - INFO - [COOKIES CHECK] Tool controller user_data_dir: C:\Users\IanKirk/.eigent/browser_profiles\profile_user_login
[info] BACKEND: 2026-02-26 08:40:00,977 - tool_controller - INFO - [COOKIES CHECK] Tool controller user_data_dir: C:\Users\IanKirk/.eigent/browser_profiles\profile_user_login
[info] before-quit
[info] quit python_process.pid: 18140
Webview 1 destroyed successfully
Webview 2 destroyed successfully
Webview 4 destroyed successfully
Webview 3 destroyed successfully
Webview 6 destroyed successfully
Webview 8 destroyed successfully
Webview 5 destroyed successfully
Webview 7 destroyed successfully
[info] window-all-closed
[info] before-quit
[info] quit python_process.pid: 18140
[info] Cleaning up Python process and all children { pid: 18140 }
[info] Cleaning up Python process and all children { pid: 18140 }
[info] Successfully sent SIGTERM to process tree
[error] Failed to clean up process tree with SIGTERM: Error: Command failed: taskkill /pid 18140 /T /F
ERROR: The process with PID 21964 (child process of PID 18140) could not be terminated.
Reason: The operation attempted is not supported.
ERROR: The process with PID 2688 (child process of PID 18140) could not be terminated.
Reason: There is no running instance of the task.
ERROR: The process with PID 18140 (child process of PID 19692) could not be terminated.
Reason: The operation attempted is not supported.

at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at ChildProcess.exithandler (node:child_process:422:12)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1104:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)

[error] Failed to force kill process tree: Error: Command failed: taskkill /pid 18140 /T /F
ERROR: The process "18140" not found.

at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at ChildProcess.exithandler (node:child_process:422:12)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1104:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)

[info] Attempting to kill process on port: 5001
[error] Failed to kill process on port 5001: Error: Command failed: netstat -ano | findstr LISTENING | findstr :5001

at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at ChildProcess.exithandler (node:child_process:422:12)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1104:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)

[info] All cleanup completed, exiting...

Additional context

Suggested direction

Any of the following would make this robust:

Resolve npx deterministically

  • Prefer an absolute path to Eigent’s own wrapper (~/.eigent/bin/npx.cmd) when present.
  • Otherwise fallback to shutil.which("npx") / which("npx.cmd").

Windows-safe invocation

  • When invoking .cmd/batch wrappers, use cmd.exe /c ... (or shell=True with care) so .cmd execution is reliable.

Pass a known-good PATH into the subprocess

  • Ensure the spawned Electron login browser inherits a PATH that includes the wrapper directory (e.g., ~/.eigent/bin) regardless of how the backend was launched.

Architectural alternative (often cleanest in desktop apps)

  • Launch the login browser from the Electron main process (which already controls environment setup), rather than from the Python backend, and communicate status back to the backend via IPC/HTTP. This avoids environment mismatch entirely.

Local workaround confirmed

I found that just adding to the user PATH wasn't enough so I patched the code. With Github Copilot's help I edited tool_controller.py to get it to work on my system. My patched tool_controller.py is attached for reference, but I doubt that it is production-ready.

tool_controller.py

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions