Skip to content

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

fix context_lines split None error

Nick Sweeting96be634f4ca8
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 4815bba3c..960913cc4 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -423,7 +423,7 @@ class Agent(Generic[Context]):
if page_filtered_actions:
all_actions += '\n' + page_filtered_actions
- context_lines = self._message_manager.settings.message_context.split('\n')
+ context_lines = (self._message_manager.settings.message_context or '').split('\n')
non_action_lines = [line for line in context_lines if not line.startswith('Available actions:')]
updated_context = '\n'.join(non_action_lines)
if updated_context: