Skip to content
Latchkey

Selenium "WebDriverException: chrome not reachable" in CI

Selenium started Chrome but lost the connection - Chrome crashed or never opened its DevTools port. In headless CI this is almost always missing sandbox/shm flags rather than a test bug.

What this error means

Session start or a command fails with "unknown error: chrome not reachable" or "unknown error: DevToolsActivePort file doesn't exist." Chrome cannot run under the default flags in a containerized CI environment.

Selenium output
selenium.common.exceptions.WebDriverException: Message: unknown error:
Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location ... is no longer running)

Common causes

Missing headless/sandbox flags in a container

As root in Docker, Chrome needs --no-sandbox; without headless and disabled gpu/shm it fails to open the DevTools port and the driver reports it unreachable.

Tiny /dev/shm crashing Chrome

The 64 MB default /dev/shm in containers makes Chrome crash on startup unless you pass --disable-dev-shm-usage or raise the shm size.

How to fix it

Pass the CI-safe Chrome flags

test_app.py
from selenium import webdriver
opts = webdriver.ChromeOptions()
opts.add_argument('--headless=new')
opts.add_argument('--no-sandbox')
opts.add_argument('--disable-dev-shm-usage')
opts.add_argument('--disable-gpu')
driver = webdriver.Chrome(options=opts)

Or raise container shared memory

Terminal
docker run --shm-size=2g ...   # instead of --disable-dev-shm-usage

How to prevent it

  • Always run headless Chrome in CI with --no-sandbox --disable-dev-shm-usage.
  • Raise --shm-size for Chrome-heavy jobs.
  • Bake a known-good Chrome+driver into the runner image.

Frequently asked questions

What causes ""chrome not reachable""?
As root in Docker, Chrome needs --no-sandbox; without headless and disabled gpu/shm it fails to open the DevTools port and the driver reports it unreachable.
How do I fix "chrome not reachable"?
Pass the CI-safe Chrome flags
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card