AgentFixboard

Passing storage_state as a dict loads no cookies

A storage_state dict passed to Browser(...) does not apply its cookies. The linked issue does not give an exception name.

From GitHub

browser-use/browser-use

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

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

Symptom

A storage_state dict passed to Browser(...) does not apply its cookies. The linked issue does not give an exception name.

Evidence what you'll see

  • The report's constructor on 0.12.0 is Browser(cdp_url=cdp_url, browser_profile=profile, keep_alive=True, storage_state={"cookies": [{"name": "sessionid", "value": "xx", "domain": "xxx", "path": "/", ...}]}).
  • The profile field is typed str | Path | dict[str, Any] | None, so the dict is accepted and then ignored.
  • On the old load path the pull request's check fails with AssertionError: dict storage_state cookie never reached the browser.

Why it happens

The storage-state watchdog turned the profile value into a string before it decided what to do. A dict became the literal text {'cookies': ...}. The loader then treated that text as a file path, os.path.exists was false, and it returned without applying any cookie. The save path used the same string, so the old code could also create a directory whose name was that dict text, with the cookie values inside the name.

Affected versions

browser-use 0.12.0 in the original report, with keep_alive=True and a cdp_url. The linked issue does not name an operating system.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

How to check it worked

  • Start with the same storage_state dict. The load source is <in-memory storage_state dict>, and the cookie named in the dict is present in the browser. The pull request checks that cookie through CDP.

If it still fails

  • A string or Path was already a file path. This bug is the in-memory dict. The linked issue does not describe a dict that has no cookies key.
  • When storage_state is a dict, the save path does not write a file. The linked pull request does not give a filename where that dict is also saved to disk.

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