selenium.common.exceptions.WebDriverException: Message: unknown error: cannot create temp dir for user data dir

Bug description:
My program is webscraping every 10 minutes, with selenium webdriver. it is always on.
After a while it runs into this error:

Traceback (most recent call last):
File “main.py”, line 171, in
main()
File “main.py”, line 35, in main
scraping()
File “main.py”, line 82, in scraping
driver = webdriver.Chrome(options=Chrome_options)
File “/home/runner/neicanalertv3/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py”, line 81, in init
super().init(
File “/home/runner/neicanalertv3/venv/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py”, line 106, in init
super().init(
File “/home/runner/neicanalertv3/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 288, in init
self.start_session(capabilities, browser_profile)
File “/home/runner/neicanalertv3/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 381, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File “/home/runner/neicanalertv3/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 444, in execute
self.error_handler.check_response(response)
File “/home/runner/neicanalertv3/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py”, line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot create temp dir for user data dir
Stacktrace:
#0 0x562e2d6b1b33
#1 0x562e2d17a6d8
#2 0x562e2d19b87d
#3 0x562e2d198fca
#4 0x562e2d1d3e0a
#5 0x562e2d1cdf53
#6 0x562e2d1a3a0a
#7 0x562e2d1a4ad5
#8 0x562e2d6e32fd
#9 0x562e2d6fc4bb
#10 0x562e2d6e50d5
#11 0x562e2d6fd145
#12 0x562e2d6d8aaf
#13 0x562e2d719ba8
#14 0x562e2d719d28
#15 0x562e2d73448d
#16 0x7eff1aae3d40

Expected vs Current Behavior:
not run into this error

Steps to reproduce:
Run my repl and wait for a few hours

Bug appears at this link:
https://replit.com/@KatharinaNi/neicanalertv3#main.py

Screenshot(s)/Screen Recording:

Browser/OS/Device: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Replit Profile: https://replit.com/@

Hey @KatharinaNi!

Is there a message above the traceback, or is that the entire error? Could you send us a screenshot of the entire error so we can see it in context?

1 Like


Hi Shane,
here is the screenshot.
Yesterday, to make it run again, I forked the repl and it worked fine for half a day. then the exact same problem reoccurred with the new repl.
here is the link of the original repl (v3), which didn’t work yesterday:
https://replit .com/@KatharinaNi/neicanalertv3#main.py
then I forked it and it ran fine for half a day (v4) :
https://replit .com/@KatharinaNi/neicanalertv4#main.py
v4 got the same issue again. The screenshot is from the v4 repl.

But now v3 is working again, maybe there is some kind of reset in the meantime?

best wishes
Katharina

Thanks!

Can you run df -h /tmp in the shell of your Repl and send me a screenshot of the output so I can make sure the temp directory that Selenium is creating isn’t overflowing the storage of your Repl?

2 Likes