browser-use/browser-use · error · ValueError

Invalid parameters {params} for action {action_name}: {type(

Error message

Invalid parameters {params} for action {action_name}: {type(e)}: {e}

What it means

Before an action runs, its LLM-supplied arguments are validated against the action's Pydantic param_model. This error wraps any Pydantic ValidationError, reporting the action name, the raw params dict, and the underlying validation message. It means the arguments do not match the action's declared schema (missing/wrong-typed fields).

Source

Thrown at browser_use/tools/registry/service.py:352

		params: dict,
		browser_session: BrowserSession | None = None,
		page_extraction_llm: BaseChatModel | None = None,
		file_system: FileSystem | None = None,
		sensitive_data: dict[str, str | dict[str, str]] | None = None,
		available_file_paths: list[str] | None = None,
		extraction_schema: dict | None = None,
	) -> Any:
		"""Execute a registered action with simplified parameter handling"""
		if action_name not in self.registry.actions:
			raise ValueError(f'Action {action_name} not found')

		action = self.registry.actions[action_name]
		try:
			# Create the validated Pydantic model
			try:
				validated_params = action.param_model(**params)
			except Exception as e:
				raise ValueError(f'Invalid parameters {params} for action {action_name}: {type(e)}: {e}') from e

			if sensitive_data:
				# Get current URL if browser_session is provided
				current_url = None
				if browser_session and browser_session.agent_focus_target_id:
					try:
						# Get current page info from session_manager
						target = browser_session.session_manager.get_target(browser_session.agent_focus_target_id)
						if target:
							current_url = target.url
					except Exception:
						pass
				validated_params = self._replace_sensitive_data(validated_params, sensitive_data, current_url)

			# Build special context dict
			special_context = {
				'browser_session': browser_session,
				'page_extraction_llm': page_extraction_llm,

View on GitHub (pinned to 6c73fced2f)

Solutions

  1. Read the embedded Pydantic message — it names the exact field and constraint that failed.
  2. Fix the params dict to match the action's param model (correct types, required fields present).
  3. For LLM-driven failures, make field names/descriptions in the param_model explicit so the model supplies them, or switch to a stronger model (ChatBrowserUse is recommended).
  4. For custom actions, make optional fields Optional with defaults instead of required.

Example fix

# before
await tools.act('click', {'idx': 5})  # wrong field name -> ValidationError

# after
await tools.act('click', {'index': 5})
Defensive patterns

Strategy: validation

Validate before calling

action = tools.registry.actions[action_name]
try:
    action.param_model(**params)  # dry-run validation before act()
except Exception as e:
    print('params invalid:', e)

Type guard

def params_valid(action, params: dict) -> bool:
    try:
        action.param_model(**params)
        return True
    except Exception:
        return False

Try / catch

try:
    await tools.act(action_name, params)
except RuntimeError as e:
    if 'Invalid parameters' in str(e):
        # inspect e.__cause__ (ValidationError) for exact field errors
        ...

Prevention

When it happens

Trigger: Calling `tools.act('click', {})` when ClickAction requires `index`; passing a string where the model expects an int (`navigate` with a non-string url); extra/unknown fields when the model forbids extras; LLM emitting malformed JSON params.

Common situations: Weak models emitting wrong parameter shapes; hand-written `act` calls in tests; schema drift after upgrading browser-use (a param became required or changed type); custom actions whose param_model is stricter than the description given to the LLM.

Related errors


AI-assisted analysis of browser-use/browser-use@6c73fced2f (2026-08-14). Data as JSON: /api/errors/222f18f5046b3fba. Report an issue: GitHub.