Skip to content

Bug: scroll/input/scroll_to_text report failed actions as successes, so multi_act never aborts and consecutive_failures never increments #5361

Closed as not planned

Description

@GautamSharma99

Browser Use Version

0.13.7 (commit 71714137)

Bug Description

Three actions in browser_use/tools/service.py return a non-error ActionResult when the underlying operation actually failed. Because the agent loop keys off ActionResult.error, a failed action is treated as a successful one.

Two places consume .error and both are bypassed:

  • Agent.multi_act() (agent/service.py:2812) breaks the remaining action queue on results[-1].error. With error=None, queued follow-up actions keep executing against a page that never changed.
  • Agent._post_process() (agent/service.py:1229) increments consecutive_failures only when last_result[-1].error is set. With error=None, the failure never counts toward max_failures.

On top of that, the LLM is told the action succeeded, so evaluation_previous_goal on the next step is reasoning from a false premise.

Site 1 — scroll reports success when every scroll attempt failed (most severe)

tools/service.py:1403-1452. For pages >= 1.0 the loop catches per-scroll exceptions, logs a warning, and increments completed_scrolls only on success. Afterwards:

if params.pages == 1.0:
    long_term_memory = f'Scrolled {direction} {target} {viewport_height}px'
else:
    long_term_memory = f'Scrolled {direction} {target} {completed_scrolls:.1f} pages'

The pages == 1.0 branch never consults completed_scrolls. Since ScrollAction.pages defaults to 1.0 (tools/views.py:132), the default scroll silently reports success after a total failure.

Measured with a scroll dispatch that always raises:

WARNING [tools] Scroll 1/1 failed: CDP scroll dispatch failed
  pages=1.0: error=None  memory='Scrolled down 1000px'      <- total failure reported as success
  pages=3.0: error=None  memory='Scrolled down 0.0 pages'   <- honest text, but still not an error
  pages=0.5: error='Failed to execute scroll action.'       <- correct

Site 2 — input returns a non-error result on a stale element index

tools/service.py:781-785:

node = await browser_session.get_element_by_index(params.index)
if node is None:
    msg = f'Element index {params.index} not available - page may have changed. Try refreshing browser state.'
    logger.warning(f'⚠️ {msg}')
    return ActionResult(extracted_content=msg)   # not error=

scroll returns ActionResult(error=msg) for the identical "index not found" condition (tools/service.py:1380-1381), so the two actions disagree. The practical effect is that a typed value silently goes nowhere and any queued follow-up (e.g. a submit click) still runs.

Site 3 — scroll_to_text cannot distinguish "not found" from "CDP failed"

tools/service.py:1502-1509. A single except Exception covers both a genuine "text is not on the page" and a real CDP/transport failure, discards the exception object entirely, and returns a non-error ActionResult in both cases. A broken CDP call is indistinguishable from a legitimate negative result.

Steps to Reproduce

Drive each action with a browser session whose event dispatch raises, and inspect the returned ActionResult.

Failing Python Code

import asyncio

from browser_use.tools.service import Tools
from browser_use.tools.views import ScrollAction


class BoomEvent:
    def __await__(self):
        async def _():
            return self
        return _().__await__()

    async def event_result(self, **kw):
        raise RuntimeError('CDP scroll dispatch failed')


class Bus:
    def dispatch(self, ev):
        return BoomEvent()


class FakeSession:
    event_bus = Bus()

    async def get_element_by_index(self, i):
        return None

    async def get_or_create_cdp_session(self):
        raise RuntimeError('no cdp')


tools = Tools()
scroll = tools.registry.registry.actions['scroll'].function


async def main():
    for pages in (1.0, 3.0, 0.5):
        r = await scroll(params=ScrollAction(down=True, pages=pages), browser_session=FakeSession())
        print(f'pages={pages}: error={r.error!r} memory={r.long_term_memory!r}')


asyncio.run(main())

Expected Behaviour

An action whose underlying operation failed returns ActionResult(error=...), so multi_act() aborts the remaining queue and _post_process() counts the failure.

Actual Behaviour

error=None and a success message. The agent proceeds as if the scroll/type happened.

Why This Matters

This is, I think, the mechanism behind a familiar class of reports — the agent scrolling repeatedly and never reaching content, or filling a form where one field silently never received its value. Because consecutive_failures never increments, max_failures never trips and the only thing that can break the cycle is the loop detector.

Suggested Fix

  • scroll: track completed_scrolls in the pages == 1.0 branch too, and return ActionResult(error=...) when completed_scrolls == 0.
  • input: return ActionResult(error=msg) for a missing index, matching scroll.
  • scroll_to_text: separate "handler reported text-not-found" from "the call raised", and include the exception detail in the latter.

Happy to open a PR. Given they share one root cause I would do them as a single change with three focused tests, but I am glad to split it if you would prefer one action per PR.

LLM Model

Not model specific.

Operating System & Browser Versions

macOS (Darwin 25.5.0), Python 3.12.13. Not platform specific.

Full DEBUG Log Output

WARNING  [tools] Scroll 1/1 failed: CDP scroll dispatch failed
  pages=1.0: error=None  memory='Scrolled down 1000px'
WARNING  [tools] Scroll 1/3 failed: CDP scroll dispatch failed
WARNING  [tools] Scroll 2/3 failed: CDP scroll dispatch failed
WARNING  [tools] Scroll 3/3 failed: CDP scroll dispatch failed
  pages=3.0: error=None  memory='Scrolled down 0.0 pages'
  pages=0.5: error='Failed to execute scroll action.'  memory=None

Activity

  1. IgorGanapolsky commented on Aug 3, 2026

    @IgorGanapolsky

    Agentic systems are turning into always-on factories: one request fans out into model calls, tool calls, policy checks, and storage.

    The hard part is rarely tokens/sec — it is control-plane reliability:

    1. Fan-out control — hard cap on tools/steps per request before external writes
    2. Durable id + idempotency — one write per business object (ledger / preflight)
    3. Observable long jobs — progress + cooperative cancel on multi-minute runs
    4. Expected vs actual — durable artifact id before marking success
    5. Policy before action — gate that can refuse known-bad side effects

    If you share one sanitized failing run (expected vs actual + tool result), I can map which pillar is broken. Architecture only.

  2. sosidudku1 commented on Aug 7, 2026

    @sosidudku1

    The pages == 1.0 branch is the sharp one, because it is the default: the most common scroll is the one that cannot report failure.

    Worth separating two costs here. The queue-abort and consecutive_failures paths are recoverable once .error is set correctly. The third consumer is not: the model reads evaluation_previous_goal and plans the next step from it. A tool that reports a false success does not just lose one action, it puts a false fact into the reasoning chain, and every later step inherits it. That failure is invisible in logs because nothing errored.

    The structural version of the question is what a tool is allowed to return. If "did the effect happen" is derived from whether an exception escaped, then any caught-and-logged failure becomes a success by default, which is exactly what the warning-then-continue loop does here. Making the outcome an explicit part of every tool's return, rather than the absence of a raised error, turns this from a bug you find per-tool into one the type system refuses.

    We run a fairly wide tool surface on our side and your report made us go audit the same thing, so thanks for the precise write-up. #5362 looks like the same shape, where the reported duration is not the waited duration, and I would guess a sweep over every except ... log ... continue in the tool layer surfaces more.

  3. jinngimk-lang commented on Aug 17, 2026

    @jinngimk-lang

    This is basically the AgentCI elevator pitch in one bug: the effect failed, but the runtime wrote “success” into the agent’s own memory and kept going. That is a false-PASS with downstream consequences, not just a bad error string.

    We’re recruiting exactly these cases for AgentCI’s public Breaker corpus. A strong fixture here would run each affected action against a deterministic failing transport and prove: dispatch failure → typed action error → queued effects stop → failure counter advances → no success memory is persisted.

    If the original reporter or another external agent contributes the minimal reusable fixture, we’ll preserve the upstream provenance and give permanent public credit/backlink in the AgentCI Breaker Hall of Fame, plus priority help converting it into a cross-runtime case.

    AgentCI: https://github.com/jinngimk-lang/agentci
    Recognition: https://github.com/jinngimk-lang/agentci/blob/main/COMMUNITY.md

    Affiliation disclosed; no Browser Use certification claim.

  4. github-actions commented on Oct 17, 2026

    @github-actions

    👋 This issue has been automatically marked as stale because it hasn't had activity for 60 days.

    ⚡ We've made significant progress recently! Please test with the latest version of browser-use to see if this issue has been resolved. If the issue persists, please let us know by commenting below.

    To keep this issue open:

    • Add a comment explaining why this is still relevant after testing the latest version
    • Add the pinned label if this is an important long-term issue
    • Reference it in a PR if you're working on a fix

    This will be automatically closed in 14 days if no further activity occurs.

    Thanks for contributing to browser-use! 🤖 If you have questions, join our Discord.

  5. github-actions commented on Nov 1, 2026

    @github-actions

    🔒 This issue was automatically closed because it was stale for 14 days with no activity.

    Don't worry! If this issue is still relevant:

    • First, test with the latest version - we've made tons of improvements recently!
    • Reopen it if you have permissions and the issue persists
    • Create a fresh issue with updated information if the problem still exists after testing the latest version
    • Join our Discord to discuss

    We appreciate your contribution to browser-use! 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions