{"record":{"id":"58832793063a099a","repo":"browser-use/browser-use","slug":"target-element-is-not-visible","errorCode":null,"errorMessage":"Target element is not visible","messagePattern":"Target element is not visible","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"browser_use/actor/element.py","lineNumber":614,"sourceCode":"\t\tif source_position:\n\t\t\tsource_x = source_position['x']\n\t\t\tsource_y = source_position['y']\n\t\telse:\n\t\t\tsource_box = await self.get_bounding_box()\n\t\t\tif not source_box:\n\t\t\t\traise RuntimeError('Source element is not visible')\n\t\t\tsource_x = source_box['x'] + source_box['width'] / 2\n\t\t\tsource_y = source_box['y'] + source_box['height'] / 2\n\n\t\t# Get target coordinates\n\t\tif isinstance(target, dict) and 'x' in target and 'y' in target:\n\t\t\ttarget_x = target['x']\n\t\t\ttarget_y = target['y']\n\t\telse:\n\t\t\tif target_position:\n\t\t\t\ttarget_box = await target.get_bounding_box()\n\t\t\t\tif not target_box:\n\t\t\t\t\traise RuntimeError('Target element is not visible')\n\t\t\t\ttarget_x = target_box['x'] + target_position['x']\n\t\t\t\ttarget_y = target_box['y'] + target_position['y']\n\t\t\telse:\n\t\t\t\ttarget_box = await target.get_bounding_box()\n\t\t\t\tif not target_box:\n\t\t\t\t\traise RuntimeError('Target element is not visible')\n\t\t\t\ttarget_x = target_box['x'] + target_box['width'] / 2\n\t\t\t\ttarget_y = target_box['y'] + target_box['height'] / 2\n\n\t\t# Perform drag operation\n\t\tawait self._client.send.Input.dispatchMouseEvent(\n\t\t\t{'type': 'mousePressed', 'x': source_x, 'y': source_y, 'button': 'left'},\n\t\t\tsession_id=self._session_id,\n\t\t)\n\n\t\tawait self._client.send.Input.dispatchMouseEvent(\n\t\t\t{'type': 'mouseMoved', 'x': target_x, 'y': target_y},\n\t\t\tsession_id=self._session_id,","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/browser-use/browser-use/blob/6c73fced2f6d45a11d88622fe56365a5fe18f28b/browser_use/actor/element.py#L596-L632","documentation":"A registered action declares `available_file_paths` (the allow-list of file paths the agent may touch) with no default, and the injected value was None. The wrapper fails fast because file-access actions must be constrained to a known path list; None would mean unrestricted or broken file access.","triggerScenarios":"Invoking a file action with available_file_paths=None, or from an Agent/tools context where available_file_paths was not configured (Agent parameter of the same name left unset while a custom action requires it).","commonSituations":"Custom file actions that mirrored the built-in write_file/read_file signature; using Tools standalone without the agent-level available_file_paths wiring; forgetting to set Agent(available_file_paths=[...]) when running actions manually.","solutions":["Pass the allow-list explicitly: await my_action(available_file_paths=['/data/out.csv'], file_system=FileSystem()).","Set Agent(available_file_paths=[...]) so the built-in injection has a value.","If the list is genuinely dynamic, make the parameter optional (default None) and resolve paths inside the action with your own checks."],"exampleFix":"# before\nresult = await save_file(path='out.csv', content='x')  # available_file_paths missing\n\n# after\nagent = Agent(task=..., llm=llm, available_file_paths=['/workspace/out.csv'])\n# or directly:\nresult = await save_file(path='out.csv', content='x', available_file_paths=['/workspace/out.csv'])","handlingStrategy":"validation","validationCode":"from inspect import signature, Parameter\n\ndef file_paths_wired(func, provided: dict) -> bool:\n    p = signature(func).parameters.get('available_file_paths')\n    if p is None or p.default is not Parameter.empty:\n        return True\n    return bool(provided.get('available_file_paths'))","typeGuard":"def requires_available_file_paths(func) -> bool:\n    p = inspect.signature(func).parameters.get('available_file_paths')\n    return p is not None and p.default is inspect.Parameter.empty","tryCatchPattern":"try:\n    await action(**kwargs)\nexcept ValueError as e:\n    if 'requires available_file_paths' in str(e):\n        await action(**kwargs, available_file_paths=ALLOWED_PATHS)","preventionTips":["Always configure Agent(available_file_paths=[...]) when file actions are registered.","Pass the allow-list explicitly in manual orchestration.","Treat the allow-list as a security boundary — keep it narrow and explicit."],"tags":["custom-actions","file-system","dependency-injection","browser-use"],"backgroundTag":null,"analyzedSha":"6c73fced2f6d45a11d88622fe56365a5fe18f28b","analyzedAt":"2026-08-14T19:42:40.557Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}