Skip to content
Latchkey

Selenium "WebDriverException: unknown error: Chrome failed to start: crashed" in CI

Chrome's sandbox requires kernel privileges that an unprivileged CI container does not grant, so Chrome exits immediately and ChromeDriver reports "Chrome failed to start: crashed". Passing --no-sandbox lets headless Chrome run in the container.

What this error means

The driver fails at startup with "selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed" and "(chrome not reachable)" on a Docker-based runner.

selenium
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed.
  (chrome not reachable)
  (The process started from chrome location /usr/bin/google-chrome is no longer running,
  so ChromeDriver is assuming that Chrome has crashed.)

Common causes

The Chrome sandbox cannot initialize in the container

Running as root in a container without the SUID sandbox helper or the needed namespaces makes Chrome abort during sandbox setup.

Too little shared memory for the renderer

The default 64 MB /dev/shm in a container can starve the renderer, so Chrome crashes right after launch.

How to fix it

Add --no-sandbox and --disable-dev-shm-usage

  1. Add --no-sandbox to the ChromeOptions so Chrome skips the sandbox helper.
  2. Add --disable-dev-shm-usage so Chrome writes to /tmp instead of the small /dev/shm.
  3. Re-run the suite headless in the container.
python
from selenium.webdriver.chrome.options import Options
opts = Options()
opts.add_argument("--headless=new")
opts.add_argument("--no-sandbox")
opts.add_argument("--disable-dev-shm-usage")

Or give the container more shared memory

When you control the container, mounting a larger /dev/shm avoids the renderer crash without disabling the sandbox.

.github/workflows/ci.yml
options:
  --shm-size=2g

How to prevent it

  • Always pass --no-sandbox and --disable-dev-shm-usage for headless Chrome in containers.
  • Raise --shm-size when you control the container runtime.
  • Use a runner image known to run headless Chrome rather than a bare slim image.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →