Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix: treat empty BROWSER_USE_API_KEY as missing in ensure_daemon

ShawnPanabebb3d1a8022
diff --git a/browser_use/skill_cli/main.py b/browser_use/skill_cli/main.py
index 0fe5d50bd..63904ebd6 100755
--- a/browser_use/skill_cli/main.py
+++ b/browser_use/skill_cli/main.py
@@ -510,7 +510,7 @@ def ensure_daemon(
# For cloud mode, ensure the daemon has the API key from CLI config (~/.browser-use/config.json).
# CloudBrowserClient checks BROWSER_USE_API_KEY env var first, so injecting it here
# prevents the library from falling back to ~/.config/browseruse/cloud_auth.json.
- if use_cloud and 'BROWSER_USE_API_KEY' not in env:
+ if use_cloud and not env.get('BROWSER_USE_API_KEY', '').strip():
from browser_use.skill_cli.commands.cloud import _get_api_key_or_none
cli_api_key = _get_api_key_or_none()