Skip to content

Headful Mode Crashes on Windows Due to Xvfb Invocation ([WinError 2] file not found) #20

@danielkornev

Description

@danielkornev

Headful Mode Crashes on Windows Due to Xvfb Invocation ([WinError 2] file not found)

Description

When running FARA in headful mode on Windows, the agent crashes immediately with repeating errors:

[WinError 2] The system cannot find the file specified
INFO:main:Closing browser...

The crash occurs before the browser opens, and the script attempts to close the browser multiple times.

Steps to Reproduce

  1. Clone the repo on a Windows machine
  2. Run:
python test_fara_agent.py --headful --task "how many pages does wikipedia have" --start_page "https://www.bing.com/
" --endpoint_config "endpoint_configs/azure_foundry_config.json"
  1. Observe crash

Expected Behavior

  • Browser should launch in a visible headful window on Windows
  • Agent should proceed with normal page navigation and task execution

Actual Behavior

  • Script attempts to start Xvfb, which does not exist on Windows
  • Raises:
[WinError 2] The system cannot find the file specified
  • Cleanup then repeatedly tries (and fails) to stop Xvfb

Root Cause

The browser initialization logic always attempts to launch Xvfb, even on Windows.
Xvfb is a Unix-only virtual framebuffer and is not available on Windows systems.

Proposed Fix (Implemented Locally)

  • Detect OS using platform.system()
  • Only start Xvfb on Linux/macOS
  • On Windows:
  • Skip Xvfb entirely
  • Allow Playwright to use native Windows display for headful mode
  • Cleanup logic should only attempt to stop Xvfb on non-Windows systems

Impact

  • Headful mode is currently broken on all Windows devices
  • Makes debugging agent behavior impossible on Windows

Environment

  • OS: Windows 10/11
  • Python: 3.x
  • Playwright: current version bundled with repo
  • FARA version: latest main branch

Additional Notes

Here's a PR with the working fix: #19

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