Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Fix exception handling in EventBus serial execution branch
claude[bot]c59665ab34ec
diff --git a/browser_use/eventbus/service.py b/browser_use/eventbus/service.pyindex f955989c5..ddaa451cc 100644--- a/browser_use/eventbus/service.py+++ b/browser_use/eventbus/service.py@@ -303,8 +303,14 @@ class EventBus:else:# otherwise, execute handlers serially, wait until each one completes before moving on to the nextfor handler_name, handler in applicable_handlers.items():- result = await self._execute_sync_or_async_handler(event, handler)- event.record_results({handler_name: result}, complete=False)+ try:+ result = await self._execute_sync_or_async_handler(event, handler)+ event.record_results({handler_name: result}, complete=False)+ except Exception as e:+ event.event_errors[handler_name] = str(e)+ logger.error(+ f'❌ {self} Handler {handler_name} failed for event {event.event_id}: {type(e).__name__} {e}\n{event.model_dump()}'+ )async def _execute_sync_or_async_handler(self, event: BaseEvent, handler: EventHandler) -> Any:"""Safely execute a single handler"""