Skip to content

Bug: start_remote_daemon fails, falls back to local detection errors, manual BU_CDP_WS workaround #181

@yousefbassem95-lang

Description

@yousefbassem95-lang

Subject: Bug Report & Workaround: start_remote_daemon Failure in Browser Harness

From: Youssef

Date: April 24, 2026


1. Executive Summary

This report details a critical issue encountered with the browser-harness tool's automated remote browser provisioning via the start_remote_daemon function. Despite correct API credentials and parameters, this function consistently fails to initiate a remote connection and incorrectly returns local browser detection errors. We have identified the root cause as a potential flaw in the start_remote_daemon or ensure_daemon logic's handling of remote connection parameters, leading to a fallback to local detection. A manual workaround has been developed by directly provisioning a remote browser and setting environment variables, which successfully establishes a connection. This issue represents a significant limitation in the tool's automated setup for users facing environmental complexities.


2. Environment Details

  • Tool: browser-harness
  • Tool Version: 0.1.0 (git)
  • Operating System: Linux (Ubuntu-based)
  • Python Version: 3.11.15
  • Browser Attempts:
    • Local Chromium (Snap version, 2:1snap1-0ubuntu2) - Failed detection.
    • Playwright's managed Chromium - Failed to locate executable reliably.
  • Remote Browser Service: Browser Use API

3. Problem Description

When attempting to provision a remote browser using the start_remote_daemon() function in admin.py, the browser-harness consistently fails. The process halts with the following error message, which is indicative of a local browser detection failure, even though the intent was to establish a remote connection:

fatal: DevToolsActivePort not found in [...] — enable chrome://inspect/#remote-debugging, or set BU_CDP_WS for a remote browser

Furthermore, running browser-harness --doctor prior to or after these failures consistently shows [FAIL] daemon alive, indicating the core daemon process is not starting correctly under these conditions.


4. Steps to Reproduce the Failure

  1. Clone the browser-harness repository.
  2. Install the tool using uv tool install -e ..
  3. Obtain a Browser Use API key.
  4. Set the BROWSER_USE_API_KEY environment variable in the shell.
  5. Execute the command to start a remote daemon:
    uv run browser-harness <<'PY'
    from admin import start_remote_daemon
    start_remote_daemon("work", proxyCountryCode="us")
    PY

Observed Behavior:
The command fails after attempting to provision a browser, returning the DevToolsActivePort not found error and indicating the daemon did not start.


5. Root Cause Analysis

Our investigation suggests the failure of start_remote_daemon stems from how it interacts with the underlying daemon initialization:

  • start_remote_daemon Flaw: This function appears to have a bug. While it successfully obtains the cdpUrl and id for a remote browser, it fails to correctly pass or utilize these details to ensure_daemon via the BU_CDP_WS and BU_BROWSER_ID environment variables.
  • Fallback to Local Detection: Consequently, ensure_daemon seems to bypass the intended remote connection parameters and defaults to its local browser detection logic, triggering the DevToolsActivePort not found error. This indicates a flaw in the automated remote setup flow.
  • Daemon Startup Failure: The consistent [FAIL] daemon alive status from --doctor confirms that the daemon process itself is not successfully initializing due to this unresolved connection issue.

6. Workaround/Solution

A functional remote connection can be established by manually replicating the steps start_remote_daemon should perform, bypassing its faulty execution flow:

  1. Manually Provision Remote Browser: Utilize the internal _browser_use function (or equivalent API call) to provision a remote browser instance.
  2. Extract Connection Details: Obtain the cdpUrl from the provisioning response and resolve it to the webSocketDebuggerUrl by querying its /json/version endpoint.
  3. Manually Set Environment Variables: Set the BU_CDP_WS and BU_BROWSER_ID environment variables in the shell with the captured remote WebSocket URL and browser ID, respectively.
  4. Execute Direct Harness Command: Run a basic browser-harness command (e.g., uv run browser-harness <<'PY' print('Remote connection established.') PY). This ensures ensure_daemon() picks up the manually set BU_CDP_WS environment variable, establishing the remote connection.

This manual setup bypasses the bug in start_remote_daemon and leverages the direct CDP connection mechanism as intended by the BU_CDP_WS variable.


7. Value to the Repository & Contribution Potential

  • Identifies a specific bug: Pinpoints a failure in the start_remote_daemon function, which prevents automated remote browser setup and incorrectly defaults to local detection errors.
  • Provides a validated workaround: Details a reliable manual process to establish a remote connection by directly using BU_CDP_WS when the automated function fails.
  • Highlights a limitation: Demonstrates that the tool's automated remote setup is not universally robust and may require manual intervention in certain environments or configurations.

Regarding the Mac Mini Challenge:
We've discovered that the automated remote setup mechanism (start_remote_daemon) fails in a specific, reproducible way. Our findings pinpoint a limitation in this core function, forcing a manual bypass. This detailed diagnosis and workaround are valuable contributions, offering insight into a specific failure mode and a functional solution. If by chance this detailed investigation and workaround are what the developers are looking for to meet their challenge criteria, we've certainly found something substantial. 😉


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions