Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Fix 'NoneType' object has no attribute 'startswith' error (#534)
Lee76de514f6f73
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 2dcad7d43..546bba42b 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -219,12 +219,15 @@ class Agent:def _set_model_names(self) -> None:self.chat_model_library = self.llm.__class__.__name__- if hasattr(self.llm, 'model_name'):- self.model_name = self.llm.model_name # type: ignore- elif hasattr(self.llm, 'model'):- self.model_name = self.llm.model # type: ignore- else:- self.model_name = 'Unknown'+ self.model_name = "Unknown"+ # Check for 'model_name' attribute first+ if hasattr(self.llm, "model_name"):+ model = self.llm.model_name+ self.model_name = model if model is not None else "Unknown"+ # Fallback to 'model' attribute if needed+ elif hasattr(self.llm, "model"):+ model = self.llm.model+ self.model_name = model if model is not None else "Unknown"if self.planner_llm:if hasattr(self.planner_llm, 'model_name'):