Bug description

There seems to be an issue with the Selenium setup. The ~/.cache directory in the Docker image does not belong to the superset user but instead belongs to the root user. When starting trying to start a headless browser, a permission denied error seems to cause the webdriver to fail:

Screenshots/recordings

Image

Image Image

Superset version

5.0.0

Python version

3.11

Node version

I don't know

Browser

Not applicable

Additional context

[2025-08-05 13:26:00,605: WARNING/ForkPoolWorker-4] Cache folder (/app/superset_home/.cache/selenium) cannot be created: Permission denied (os error 13)
[2025-08-05 13:26:00,606: WARNING/ForkPoolWorker-4] Cache folder (/app/superset_home/.cache/selenium) cannot be created: Permission denied (os error 13)
[2025-08-05 13:26:00,606: WARNING/ForkPoolWorker-4] The geckodriver version (0.34.0) detected in PATH at /usr/bin/geckodriver might not be compatible with the detected firefox version (128.13.0); currently, geckodriver 0.36.0 is recommended for firefox 128.*, so it
is advised to delete the driver in PATH and retry
[2025-08-05 13:28:10,828: WARNING/ForkPoolWorker-4] SupersetError(message='[Errno 111] Connection refused', error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra=None)
[2025-08-05 13:28:10,835: ERROR/ForkPoolWorker-4] A downstream exception occurred while generating a report: fcd05b88-6472-4e9d-91ec-375af5882fdb. Failed taking a screenshot HTTPConnectionPool(host='localhost', port=34831): Read timed out. (read timeout=120)
Traceback (most recent call last):
  File "/app/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/app/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.10/http/client.py", line 1375, in getresponse
    response.begin()
  File "/usr/local/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.10/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.10/socket.py", line 717, in readinto
    return self._sock.recv_into(b)
TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/superset/commands/report/execute.py", line 357, in _get_screenshots
    if imge := screenshot.get_screenshot(user=user):
  File "/app/superset/utils/screenshots.py", line 176, in get_screenshot
    self.screenshot = driver.get_screenshot(self.url, self.element, user)
  File "/app/superset/utils/webdriver.py", line 387, in get_screenshot
    driver = self.auth(user)
  File "/app/superset/utils/webdriver.py", line 311, in auth
    driver = self.create()
  File "/app/superset/utils/webdriver.py", line 308, in create
    return driver_class(**kwargs)
  File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 241, in __init__
    self.start_session(capabilities)
  File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 329, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
  File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 382, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 404, in execute
    return self._request(command_info[0], url, body=data)
  File "/app/.venv/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 428, in _request
    response = self._conn.request(method, url, body=body, headers=headers, timeout=self._client_config.timeout)
  File "/app/.venv/lib/python3.10/site-packages/urllib3/request.py", line 81, in request
    return self.request_encode_body(
  File "/app/.venv/lib/python3.10/site-packages/urllib3/request.py", line 173, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/app/.venv/lib/python3.10/site-packages/urllib3/poolmanager.py", line 376, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/app/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
  File "/app/.venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/app/.venv/lib/python3.10/site-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/app/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
  File "/app/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 469, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/app/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 358, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=34831): Read timed out. (read timeout=120)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/superset/tasks/scheduler.py", line 99, in execute
    ).run()
  File "/app/superset/utils/decorators.py", line 266, in wrapped
    return on_error(ex)
  File "/app/superset/utils/decorators.py", line 236, in on_error
    raise ex
  File "/app/superset/utils/decorators.py", line 259, in wrapped
    result = func(*args, **kwargs)
  File "/app/superset/commands/report/execute.py", line 896, in run
    ).run()
  File "/app/superset/utils/decorators.py", line 266, in wrapped
    return on_error(ex)
  File "/app/superset/utils/decorators.py", line 236, in on_error
    raise ex
  File "/app/superset/utils/decorators.py", line 259, in wrapped
    result = func(*args, **kwargs)
  File "/app/superset/commands/report/execute.py", line 858, in run
    ).next()
  File "/app/superset/commands/report/execute.py", line 726, in next
    self.send()
  File "/app/superset/commands/report/execute.py", line 624, in send
    notification_content = self._get_notification_content()
  File "/app/superset/commands/report/execute.py", line 509, in _get_notification_content
    pdf_data = self._get_pdf()
  File "/app/superset/commands/report/execute.py", line 375, in _get_pdf
    screenshots = self._get_screenshots()
  File "/app/superset/commands/report/execute.py", line 363, in _get_screenshots
    raise ReportScheduleScreenshotFailedError(
superset.commands.report.exceptions.ReportScheduleScreenshotFailedError: Failed taking a screenshot HTTPConnectionPool(host='localhost', port=34831): Read timed out. (read timeout=120)

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

This is a known class of issue with Docker-based Superset deployments: if the ~/.cache directory (or its subdirectories) is owned by root instead of the superset user, Selenium can't write to it, causing "Permission denied" errors and screenshot/report failures. This isn't handled in Superset's Python code but is a result of Docker image setup and file ownership during build or container startup. The default 5.0.0 image doesn't explicitly fix this, so the bug can appear when running as the superset user example.

To work around this, you can add a command to your Dockerfile or entrypoint to fix directory ownership before starting Superset, for example:

USER root
RUN chown -R superset:superset /app/superset_home/.cache || true
USER superset

or, in your entrypoint script:

chown -R superset:superset /app/superset_home/.cache || true

You also have a geckodriver/Firefox version mismatch: geckodriver 0.36.0 is recommended for Firefox 128.*. Download and install the correct geckodriver version in your Dockerfile to avoid further Selenium failures example.

If you want to avoid these manual steps, using the -dev image (which includes browsers and drivers with correct permissions) is a common workaround example.

Let me know if you need a full Dockerfile example or more details on aligning geckodriver and Firefox versions.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

Comment From: rusackas

The bot is correct! Closing, but happy to move it to a Q&A thread if there's more to address.