Skip to content

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

hot-fix/error-count-only-for-single-steps

Magnus Müllerc40daa14eb68
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 8463e66f0..94a4d85a5 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -799,7 +799,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):
await self._check_and_update_downloads('after executing actions')
# check for action errors and len more than 1
- if self.state.last_result and len(self.state.last_result) > 1 and self.state.last_result[-1].error:
+ if self.state.last_result and len(self.state.last_result) == 1 and self.state.last_result[-1].error:
self.state.consecutive_failures += 1
self.logger.debug(f'🔄 Step {self.state.n_steps}: Consecutive failures: {self.state.consecutive_failures}')
return