`browser-harness --update` crashes with `FileNotFoundError` when `uv` isn't installed

Author: rajarshidattapyCreated Aug 29, 2026Updated Aug 29, 2026

Labels: bug, cli, ux

Description

run_update() branches on install mode. The pypi branch shells out to uv unconditionally:

python
# src/browser_harness/admin.py:1229-1232
elif mode == "pypi":
    tool_upgrade = subprocess.run(["uv", "tool", "upgrade", "browser-harness"])
    if tool_upgrade.returncode != 0:
        return tool_upgrade.returncode

There is no shutil.which("uv") guard — grepping the whole package, "uv" appears exactly once, on that line. _install_mode() returns "pypi" for any non-git install that reports a version (admin.py:820-824), which includes every pip install browser-harness and pipx install browser-harness.

Neighbouring code in the same module does guard its external tools:

python
# admin.py:1029, 1054
if not shutil.which("profile-use"):
    raise RuntimeError("profile-use not installed -- curl -fsSL https://browser-use.com/profile.sh | sh")

Impact

A pip-installed user runs the command the tool itself told them to run. run.py's help advertises it, and print_update_banner() nags on it once a day:

[browser-harness] update available: 0.1.9 -> 0.1.10
[browser-harness] agents: run `browser-harness --update -y` to upgrade and restart the daemon

and gets a raw traceback:

Traceback (most recent call last):
  File ".../browser_harness/admin.py", line 1230, in run_update
    tool_upgrade = subprocess.run(["uv", "tool", "upgrade", "browser-harness"])
  ...
FileNotFoundError: [WinError 2] The system cannot find the file specified

Worse for the advertised agent path: --update -y is documented as the agent command (browser-harness --update [-y] pull the latest version (agents: pass -y)). An agent that runs it gets an unhandled exception, no diagnosis, and no idea that the fix is "install a different package manager".

Note pyproject.toml does not require uv, install.md documents both uv and pip installs, and nothing else in the runtime depends on uv — so this is the only place the tool assumes a uv install.

Reproduction

On a machine without uv:

bash
pip install browser-harness
browser-harness --update -y

Suggested fix

Detect the installer and fall back, rather than assuming:

python
elif mode == "pypi":
    if shutil.which("uv"):
        cmd = ["uv", "tool", "upgrade", "browser-harness"]
    else:
        cmd = [sys.executable, "-m", "pip", "install", "--upgrade", "browser-harness"]
    r = subprocess.run(cmd)
    if r.returncode != 0:
        return r.returncode

If auto-upgrading a pip install is deliberately out of scope, then say so instead of crashing — print the exact pip install --upgrade browser-harness line and return non-zero. Either is fine; an unhandled FileNotFoundError is not.

Source: browser-use/browser-harness