browser-use: Error=Could not parse response
Bug Description
I keep getting this error! I am using ollama model = “llama3.2:1b” AgentHistoryList(all_results=[ActionResult(is_done=False, extracted_content=None, error=‘Could not parse response.\n\nReturn a valid JSON object with the required fields.’, include_in_memory=True), ActionResult(is_done=False, extracted_content=None, error=‘Could not parse response.\n\nReturn a valid JSON object with the required fields.’, include_in_memory=True), ActionResult(is_done=False, extracted_content=None, error=‘Could not parse response.\n\nReturn a valid JSON object with the required fields.’, include_in_memory=True)], all_model_outputs=[])
Reproduction Steps
follow the quickstart. Change code to ollama example
Code Sample
import os
import asyncio
from browser_use import Agent, Browser, BrowserConfig
from browser_use.agent.views import AgentHistoryList
from langchain_ollama import ChatOllama
os.environ["OLLAMA_HOST"] = "http://127.0.0.1:11434"
browser = Browser(
config=BrowserConfig(
chrome_instance_path='C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'
)
)
async def run_search() -> AgentHistoryList:
agent = Agent(
task="Search quora.com.",
llm=ChatOllama(
model="llama3.2:1b",
num_ctx=32000,
browser=browser
)
)
result = await agent.run()
return result
async def main():
result = await run_search()
print("\n\n", result)
if __name__ == "__main__":
asyncio.run(main())
Version
Version: 0.1.29
LLM Model
Local Model (Specify model in description)
Operating System
Windows
Relevant Log Output
AgentHistoryList(all_results=[ActionResult(is_done=False, extracted_content=None, error='Could not parse response.\n\nReturn a valid JSON object with the required fields.', include_in_memory=True), ActionResult(is_done=False, extracted_content=None, error='Could not parse response.\n\nReturn a valid JSON object with the required fields.', include_in_memory=True), ActionResult(is_done=False, extracted_content=None, error='Could not parse response.\n\nReturn a valid JSON object with the required fields.', include_in_memory=True)], all_model_outputs=[])
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 37 (1 by maintainers)
Doesn’t work, same error as others
I use the example ollama file at Here and it worked.
Just change the model name with yours
I don’t know what is up, but I recommend just using Gemini Flash API because it is free, which is hard to beat.
browser-usedo not work well with smaller open source models. It can not produce instructions for the browser to go on and execute any steps.Some results with
deepseek-r1:14bor upwards - anything below this just flat out produce no steps at all 😆. It sucks! llama:8b or so on are pretty good at tool calling - the lib should handle tool calling for these models.Code for reference https://github.com/browser-use/browser-use/blob/main/browser_use/agent/service.py#L427-L458
Any progress on this? I am getting the same error. I can see the model loading into GPU vram, (qwen2.5:7b) followed by a blank browser window.
Could not parse response.\n\nReturn a valid JSON object with the required fields.
I am Getting same error, In macOS
Working for me using Gemini only. Thanks @Runtrons Tried different modals locally none work.
Gemini Key: https://aistudio.google.com/apikey Sample Code: https://github.com/browser-use/browser-use/blob/main/examples/models/gemini.py
Yep, i’m getting too this error in
deepseek-r1andqwen2.5with ollama.My code:
Output:
I ran a packet capture session between the machine running browser-use and the Ollama host, and found that Ollama is actually completing the task, but something in the browser-use code is not correctly processing the response from Ollama.
Here’s the output from the browser-use session: INFO [agent] 🚀 Starting task: Find the date of the latest wildfire press release on the current page INFO [controller] 🔗 Navigated to https://www.redcross.org/about-us/news-and-events/latest-news.html INFO [agent] 📍 Step 1 ERROR [agent] ❌ Result failed 1/3 times: Could not parse response. INFO [agent] 📍 Step 1 ERROR [agent] ❌ Result failed 2/3 times: Could not parse response. INFO [agent] 📍 Step 1 ERROR [agent] ❌ Result failed 3/3 times: Could not parse response. ERROR [agent] ❌ Stopping due to 3 consecutive failures
Here are the versions I’m using uv pip list | grep browser-use browser-use 0.1.37
ollama -v ollama version is 0.5.7
Here’s the code I’m using `from langchain_ollama import ChatOllama import os from browser_use import Agent import asyncio
async def main(): try: llm = ChatOllama( model=“qwen2.5:14b-instruct-q2_K”, num_ctx=32000, temperature=0, base_url=“http://192.168.1.13:11434” ) agent = Agent( initial_actions=[{“go_to_url”: {“url”: “https://www.redcross.org/about-us/news-and-events/latest-news.html”}}], task=“Find the date of the latest wildfire press release on the current page”, use_vision=False, llm=llm ) result = await agent.run() print(result) except Exception as e: print(f"Error occurred: {e}")
asyncio.run(main())`
Here’s the TCP stream from Ollama HTTP/1.1 200 OK Content-Type: application/x-ndjson Date: Thu, 20 Feb 2025 13:34:06 GMT Transfer-Encoding: chunked
3d7 {“model”:“qwen2.5:14b-instruct-q2_K”,“created_at”:“2025-02-20T13:34:06.400145833Z”,“message”:{“role”:“assistant”,“content”:“{\n "current_state": {\n "page_summary": "The current page is the Red Cross news and events page with several recent press releases listed.",\n "evaluation_previous_goal": "Success - I have navigated to the correct URL",\n "memory": "I have opened the first page of the Red Cross news and events section. There are multiple press release dates listed, including February 19th, 2025 for Dr Jeffrey Upperman’s share on the Scientific Advisory Council.",\n "next_goal": "Identify the date of the latest wildfire press release"\n },\n "action": [\n {\n "scroll_down": {}\n }\n ]\n}”},“done_reason”:“stop”,“done”:true,“total_duration”:27608215830,“load_duration”:58767894,“prompt_eval_count”:3745,“prompt_eval_duration”:3578000000,“eval_count”:141,“eval_duration”:23734000000}
0
HTTP/1.1 200 OK Content-Type: application/x-ndjson Date: Thu, 20 Feb 2025 13:34:35 GMT Transfer-Encoding: chunked
38e {“model”:“qwen2.5:14b-instruct-q2_K”,“created_at”:“2025-02-20T13:34:35.067965042Z”,“message”:{“role”:“assistant”,“content”:“{\n "current_state": {\n "page_summary": "The current page is the Red Cross news and events page with several recent press releases listed. The latest wildfire-related press release found was dated February 19, 2025.",\n "evaluation_previous_goal": "Success",\n "memory": "I have navigated to the correct page and identified the date of the latest wildfire press release on this page. I have completed 1/1 task.",\n "next_goal": "Complete the ultimate task"\n },\n "action": [\n {\n "done": {}\n }\n ]\n}”},“done_reason”:“stop”,“done”:true,“total_duration”:26503723521,“load_duration”:64809739,“prompt_eval_count”:3763,“prompt_eval_duration”:4804000000,“eval_count”:127,“eval_duration”:21430000000}
0
HTTP/1.1 200 OK Content-Type: application/x-ndjson Date: Thu, 20 Feb 2025 13:35:06 GMT Transfer-Encoding: chunked
3e8 {“model”:“qwen2.5:14b-instruct-q2_K”,“created_at”:“2025-02-20T13:35:06.691270371Z”,“message”:{“role”:“assistant”,“content”:“{\n "current_state": {\n "page_summary": "The current page is the Red Cross news and events page with several recent press releases listed. The latest wildfire-related press release found was dated February 19, 2025.",\n "evaluation_previous_goal": "Success",\n "memory": "I have navigated to the correct URL and identified the date of the latest wildfire press release on this page. I have done 1/1 task.",\n "next_goal": "Identify the date of the latest wildfire-related press release."\n },\n "action": [\n {\n "extract_content": {"goal": "latest wildfire press release date"}\n }\n ]\n}”},“done_reason”:“stop”,“done”:true,“total_duration”:29409661672,“load_duration”:65923839,“prompt_eval_count”:3781,“prompt_eval_duration”:4825000000,“eval_count”:144,“eval_duration”:24238000000}
0
I made a bit of introspection and it seems some of the models available at Ollama may not be compatible (?) with the recent versions of browser-use.
I tried @JoeZ34 's findings and it seems to work on simple tasks. It fails on fairly complex tasks though but I find using the higher end versions such as 32b to handle them.
Additionally I tested it with llama 3.3 as well, specifically llama3.3:70b-instruct-q2_K and it seems to work as well too.
Although it is extremely slow, not sure if this is normal or not. Other LLMs like OpenAI seems to work at a more faster pace.
I am using “model=“qwen2.5:32b-instruct-q4_K_M””. I am using default system prompt, which I believe is in prompts.py.
My full constructor
System prompt