Cannot get Chrome to work with web-ui – CDP connection error despite clean setup
I've been trying to get Chrome working with web-ui, but I keep running into the following error:
ERROR [browser] Failed to initialize Playwright browser: To start chrome in Debug mode, you need to close all existing Chrome instances and try again otherwise we can not connect to the instance.
ERROR [browser] ❌ Failed to create new browser session: To start chrome in Debug mode, you need to close all existing Chrome instances and try again otherwise we can not connect to the instance. (did the browser process quit?)
ERROR [agent] ❌ Result failed 2/3 times:
To start chrome in Debug mode, you need to close all existing Chrome instances and try again otherwise we can not connect to the instance.
INFO [agent] 📍 Step 1
ERROR [browser] ❌ Failed to start a new Chrome instance: BrowserType.connect_over_cdp: connect ECONNREFUSED ::1:9222
Call log:
- <ws preparing> retrieving websocket url from http://localhost:9222
My setup:
-
Fresh Windows 10 VM install
-
Fresh Chrome installation
-
web-ui installed and working with default Chromium in incognito mode
-
All existing Chrome instances fully closed before running
I have tried:
-
Rebooting system multiple times
-
Running with and without setting BROWSER_PATH and BROWSER_USER_DATA
-
Supplying and omitting the Browser Binary Path and User Data Dir fields in the UI
-
Confirmed no other Chrome is running in the background (checked Task Manager)
Request: If anyone has gotten this working with Chrome, I would really appreciate some help.
Please keep in mind I'm not a full-on developer, and getting web-ui installed in the first place already required help from ChatGPT, as the current instructions are vague (e.g., the Quickstart guide links to browser-use, not directly to web-ui).
I did find the instructions on the GitHub main page under "Using Your Own Browser (Optional)", which explain how to set BROWSER_PATH and BROWSER_USER_DATA environment variables. However, it’s unclear whether these environment variables are used automatically or whether they need to be re-entered into the Browser Settings UI under "Browser Binary Path" and "User Data Dir".
I've tried both approaches (with and without setting the fields in the UI), and neither seemed to make a difference. If the UI fields override or ignore environment variables—or vice versa—it would be great to make that behavior more explicit in the docs.
Thanks a lot for your time and support!
please close all chrome windows
please close all chrome windows
@warmshao Thanks for the reply!
As I mentioned in the original post, I’ve already made sure all Chrome windows are closed, and I even checked Task Manager to confirm that no Chrome processes were running in the background.
Just to be thorough, I also restarted the VM, and on a completely fresh boot—with nothing else running—I still get the exact same error.
Let me know if there's anything else I should try!
Seeing the same error on MacOS. I also close all chrome processes, retried with both Chrome and Chrome Dev but no luck.
@warmshao I think I’ve figured out part of what might be causing this issue.
I was able to get everything working on an Ubuntu 24.04 VM, and discovered something important in the process:
✅ Setting the BROWSER_USER_DATA environment variable fixes the problem.
If I leave BROWSER_USER_DATA blank (or don’t set it at all), launching Chrome fails with the same error:
ERROR [browser] ❌ Failed to start a new Chrome instance: BrowserType.connect_over_cdp: connect ECONNREFUSED ::1:9222
As soon as I set a valid path for BROWSER_USER_DATA, everything starts working—no other changes needed.
🛑 Also worth noting: The “Browser Binary Path” and “Browser User Data Dir” fields in the Browser Settings UI seem to have no effect at all (at least on Ubuntu). Even if I paste in the exact same paths used in the .env file, I still get the same error. So either those fields are broken or they’re not connected to the backend configuration properly.
Hopefully this helps anyone else running into the same issue, and maybe gives a clue to what's going wrong on Windows or macOS too.
Let me know if anyone else can confirm!
Thank you. It's now running normally following your method.
Came across this while trying to fix similar error.
Apparently, it is caused by a Chrome Security Update.
I had some partial success with the workaround here in 1520
This is a major blocker for the majority of use cases
@serge402 ✅ Setting the BROWSER_USER_DATA environment variable fixes the problem.
Could you please help check if this is the setting