{"record":{"id":"222f18f5046b3fba","repo":"browser-use/browser-use","slug":"invalid-parameters-params-for-action-action-nam","errorCode":null,"errorMessage":"Invalid parameters {params} for action {action_name}: {type(e)}: {e}","messagePattern":"Invalid parameters (.+?) for action (.+?): (.+?): (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"browser_use/tools/registry/service.py","lineNumber":352,"sourceCode":"\t\tparams: dict,\n\t\tbrowser_session: BrowserSession | None = None,\n\t\tpage_extraction_llm: BaseChatModel | None = None,\n\t\tfile_system: FileSystem | None = None,\n\t\tsensitive_data: dict[str, str | dict[str, str]] | None = None,\n\t\tavailable_file_paths: list[str] | None = None,\n\t\textraction_schema: dict | None = None,\n\t) -> Any:\n\t\t\"\"\"Execute a registered action with simplified parameter handling\"\"\"\n\t\tif action_name not in self.registry.actions:\n\t\t\traise ValueError(f'Action {action_name} not found')\n\n\t\taction = self.registry.actions[action_name]\n\t\ttry:\n\t\t\t# Create the validated Pydantic model\n\t\t\ttry:\n\t\t\t\tvalidated_params = action.param_model(**params)\n\t\t\texcept Exception as e:\n\t\t\t\traise ValueError(f'Invalid parameters {params} for action {action_name}: {type(e)}: {e}') from e\n\n\t\t\tif sensitive_data:\n\t\t\t\t# Get current URL if browser_session is provided\n\t\t\t\tcurrent_url = None\n\t\t\t\tif browser_session and browser_session.agent_focus_target_id:\n\t\t\t\t\ttry:\n\t\t\t\t\t\t# Get current page info from session_manager\n\t\t\t\t\t\ttarget = browser_session.session_manager.get_target(browser_session.agent_focus_target_id)\n\t\t\t\t\t\tif target:\n\t\t\t\t\t\t\tcurrent_url = target.url\n\t\t\t\t\texcept Exception:\n\t\t\t\t\t\tpass\n\t\t\t\tvalidated_params = self._replace_sensitive_data(validated_params, sensitive_data, current_url)\n\n\t\t\t# Build special context dict\n\t\t\tspecial_context = {\n\t\t\t\t'browser_session': browser_session,\n\t\t\t\t'page_extraction_llm': page_extraction_llm,","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/browser-use/browser-use/blob/6c73fced2f6d45a11d88622fe56365a5fe18f28b/browser_use/tools/registry/service.py#L334-L370","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the embedded Pydantic message — it names the exact field and constraint that failed.","Fix the params dict to match the action's param model (correct types, required fields present).","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).","For custom actions, make optional fields Optional with defaults instead of required."],"exampleFix":"# before\nawait tools.act('click', {'idx': 5})  # wrong field name -> ValidationError\n\n# after\nawait tools.act('click', {'index': 5})","handlingStrategy":"validation","validationCode":"action = tools.registry.actions[action_name]\ntry:\n    action.param_model(**params)  # dry-run validation before act()\nexcept Exception as e:\n    print('params invalid:', e)","typeGuard":"def params_valid(action, params: dict) -> bool:\n    try:\n        action.param_model(**params)\n        return True\n    except Exception:\n        return False","tryCatchPattern":"try:\n    await tools.act(action_name, params)\nexcept RuntimeError as e:\n    if 'Invalid parameters' in str(e):\n        # inspect e.__cause__ (ValidationError) for exact field errors\n        ...","preventionTips":["Write explicit field descriptions in param_model classes so the LLM supplies correct types.","Dry-run `action.param_model(**params)` in tests for every hand-built act() call.","Prefer ChatBrowserUse for reliable parameter formatting."],"tags":["pydantic","validation","llm-output","params"],"backgroundTag":null,"analyzedSha":"6c73fced2f6d45a11d88622fe56365a5fe18f28b","analyzedAt":"2026-08-14T19:42:40.557Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}