Agent FixboardAgentFixboard

Second run after add_new_task fails with QueueShutDown

The first agent.run() finishes, then agent.add_new_task() and a second agent.run() raise 'bubus.service.QueueShutDown'.

From GitHub

browser-use/browser-use

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
0.6.0
Last checked

Verified fix: PR #2649 merged on . Fixed in 0.6.0 (first published release whose tag contains the merge commit). Last checked .

Symptom

The first agent.run() finishes, then agent.add_new_task() and a second agent.run() raise 'bubus.service.QueueShutDown'.

Evidence what you'll see

  • The traceback in the report ends at bubus/service.py in put_nowait, raising QueueShutDown, from eventbus.dispatch(CreateAgentSessionEvent.from_agent(self)).
  • The report's agent uses BrowserProfile(keep_alive=True) and one BrowserSession for both tasks.
  • Comments on 20 Aug 2025 and 21 Aug 2025 still see the same exception on 0.6.0.

Why it happens

Pull request #2649 says the first agent.run() dispatches CreateAgentSessionEvent, and when that run ends the event bus shuts down. add_new_task() changes the task text and does not start the bus again, so the next run() puts an event on a closed queue. The pull request adds session_initialized: bool = False on AgentState and dispatches CreateAgentSessionEvent only when that flag is false, then sets the flag. CreateAgentTaskEvent is still dispatched on every run, because the task can change.

Affected versions

Reported on browser-use 0.5.9, macOS, with the traceback under Python 3.13. A comment also sees it on 0.5.11. The library log line in the report is Browser-Use Library Version 0.5.9 (pip).

Fix steps

0 of 2 done

Your check marks stay in this browser only.

How to check it worked

  • Run one task, call add_new_task(), run again, and confirm the second run does not raise bubus.service.QueueShutDown.

If it still fails

  • Two comments say 0.6.0 still raises QueueShutDown. One of them quotes await self.eventbus.stop(timeout=10.0) and await self.close() at the end of run(), and says the bus should not stop inside run().
  • On 8 Sep 2025 a maintainer wrote that the newest version fixed it, and linked https://github.com/browser-use/browser-use/blob/main/examples/features/follow_up_task.py. The linked issue does not name that version.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it