Skip to content
Latchkey

Karma "There is no captured browser, open http://localhost:9876/" in CI

Karma starts a server on port 9876 and waits for a browser to load that URL and be captured. With no headless flags on a display-less runner, no browser connects, so Karma reports "There is no captured browser".

What this error means

Karma logs "WARN [karma]: No captured browser, open http://localhost:9876/" repeatedly and the run fails without executing any spec.

karma
30 06 2026 12:00:00.000:WARN [karma]: No captured browser, open http://localhost:9876/
30 06 2026 12:00:00.000:INFO [Chrome]: Trying to start Chrome ...
30 06 2026 12:00:30.000:WARN [launcher]: Chrome have not captured in 60000 ms, killing.

Common causes

A headed browser on a runner with no display

The Chrome launcher tries to open a window where there is no display, so the browser never loads the capture URL.

Sandbox crash prevents capture

Headless Chrome in a root container without --no-sandbox crashes before it can connect to Karma.

How to fix it

Use a headless launcher with container flags

  1. Define a custom launcher extending ChromeHeadless with --no-sandbox.
  2. Set browsers to that launcher in CI.
  3. Re-run so the browser captures.
karma.conf.js
// karma.conf.js
customLaunchers: {
  ChromeHeadlessCI: { base: 'ChromeHeadless', flags: ['--no-sandbox', '--disable-dev-shm-usage'] },
},
browsers: ['ChromeHeadlessCI'],

Run Karma once and exit

Use single-run mode so CI does not hang waiting for an interactive browser to attach.

Terminal
npx karma start --single-run --browsers ChromeHeadlessCI

How to prevent it

  • Use a ChromeHeadless launcher with --no-sandbox in CI.
  • Run Karma in single-run mode so it does not wait for a manual browser.
  • Avoid headed launchers on display-less runners.

Related guides

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