Browser automation fails: Playwright cannot install - $HOME not set

Summary

The browser_subagent tool fails on all browser automation tasks with a Playwright installation error.

Error Message

failed to create browser context: failed to install playwright: $HOME environment variable is not set

Steps to Reproduce

  1. Use Antigravity agent on Windows
  2. Invoke any browser_subagent task (e.g., navigate to localhost:3000)
  3. Task fails immediately with the above error

Expected

Browser opens, navigates to URL, and allows interaction/screenshots.

Actual

All browser automation fails. Multiple retries produce the same error.

Impact

  • Cannot visually verify UI changes
  • Cannot capture screenshots for walkthroughs
  • Cannot perform browser-based testing

Environment

  • OS: Windows
  • Date: January 29, 2026

Notes

This appears to be an infrastructure configuration issue where the container/environment running Playwright doesn’t have the $HOME environment variable set, which is required for Playwright installation.

1 Like

This is a known Windows issue — Playwright expects a Linux-style $HOME variable that Windows doesn’t set by default (it uses %USERPROFILE% instead). Quick fix: open PowerShell and run [System.Environment]::SetEnvironmentVariable(‘HOME’, $env:USERPROFILE, ‘User’). Restart your IDE after that and browser automation should work. Someone else posted this as a tip in a separate thread and confirmed it resolves the issue. Would be nice if the Antigravity team just set this automatically on Windows installs.

1 Like

Thanks. It worked. Fixed the issue.Now browser subagent opens and do the tasks nicely.

Hi @Algis
Thanks for providing the solution in this thread! For anyone else running into the $HOME environment variable is not set error while using browser automation on Windows, the fix has been confirmed in the link below. It involves a quick PowerShell command to map your user profile correctly so Playwright can initialize.