Skip to content

Commit 0d869e0

Browse files
chrisschnablclaude
andcommitted
fix(browser-use): Fix DynamicContentWatchdog AttributeError causing agent startup failures
The DynamicContentWatchdog was trying to access event.target_id on BrowserStateRequestEvent objects, but this attribute doesn't exist on that event type. This caused an AttributeError that prevented agents from starting properly, resulting in 0-step failures in evaluations. The fix adds a hasattr() check before accessing the target_id attribute, ensuring the watchdog gracefully handles events that don't have this attribute. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent dc36acd commit 0d869e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

browser_use/browser/watchdogs/dynamic_content_watchdog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ async def on_NavigationCompleteEvent(self, event: NavigationCompleteEvent) -> No
4646

4747
async def on_BrowserStateRequestEvent(self, event: BrowserStateRequestEvent) -> None:
4848
"""Ensure dynamic content is loaded before state capture."""
49-
if event.target_id:
49+
# Check if event has target_id attribute before accessing it
50+
if hasattr(event, 'target_id') and event.target_id:
5051
await self._ensure_dynamic_content_loaded(event.target_id)
5152

5253
async def _start_dynamic_content_monitoring(self, target_id: str, url: str) -> None:

0 commit comments

Comments
 (0)