Skip to content

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

catch small issue

mertunsall4f18bf8cc829
diff --git a/browser_use/filesystem/file_system.py b/browser_use/filesystem/file_system.py
index 6af9c7a07..5fc194783 100644
--- a/browser_use/filesystem/file_system.py
+++ b/browser_use/filesystem/file_system.py
@@ -326,6 +326,9 @@ class FileSystem:
if not self._is_valid_filename(full_filename):
return INVALID_FILENAME_ERROR_MESSAGE
+ if not old_str:
+ return 'Error: Cannot replace empty string. Please provide a non-empty string to replace.'
+
file_obj = self.get_file(full_filename)
if not file_obj:
return f"File '{full_filename}' not found."