Skip to content

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

Enhance error reporting in agent service by including the original exception message in ValueError, improving debugging information.

Magnus Müllerd2059e85125d
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 0f30191ce..d7f05216e 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -1111,7 +1111,7 @@ class Agent(Generic[Context]):
response['parsed'] = parsed
except (ValueError, ValidationError) as e:
logger.warning(f'Failed to parse model output: {output} {str(e)}')
- raise ValueError('Could not parse response.')
+ raise ValueError('Could not parse response.' + str(e))
elif self.tool_calling_method is None:
structured_llm = self.llm.with_structured_output(self.AgentOutput, include_raw=True)