Skip to content
FramesField
FIX 52 · AGENTS, MCP & DESIGN-TO-CODE
raw .md ↗ Verified Dec 1, 2026

Fix Playwright Visual QA MCP Missing Chromium Executable

Direct Fix: Install the matching Chromium binary via npx -y playwright install chromium (plus install-deps chromium on Linux), pass --browser chromium --headless --isolated to @playwright/mcp, and verify PLAYWRIGHT_BROWSERS_PATH matches your cache folder.
Exact Error / Visual Signature
browserType.launch: Executable doesn't exist at ~/Library/Caches/ms-playwright/chromium-XXXX/... | Error: Chrome distribution "chrome" is not found | error while loading shared libraries: libnspr4.so / libgbm.so.1
OBSERVED SYMPTOM

Your @playwright/mcp server connects cleanly inside Claude Code or Cursor, yet the very first browser_navigate or screenshot tool call crashes with Executable doesn’t exist, missing Chrome distribution, or Linux shared-library errors.

TECHNICAL ROOT CAUSE

Three environment mismatches break Playwright browser launches: @playwright/mcp defaults to system Chrome (channel "chrome") or a newly bumped Chromium revision missing from your ms-playwright cache; Linux/WSL/Docker hosts lack Chromium OS shared libraries; or mismatched PLAYWRIGHT_BROWSERS_PATH variables and stale browser profile locks block startup.

Copy-Paste Verified Fix

Playwright MCP Chromium Cache Repair, Linux Deps & Launch Smoke Test fix-playwright-mcp-browser.sh
#!/usr/bin/env bash
set -euo pipefail

echo "=== 1. Inspecting Playwright browser cache directory ==="
if [[ "$(uname -s)" == "Darwin" ]]; then
  CACHE_DIR="${PLAYWRIGHT_BROWSERS_PATH:-$HOME/Library/Caches/ms-playwright}"
else
  CACHE_DIR="${PLAYWRIGHT_BROWSERS_PATH:-$HOME/.cache/ms-playwright}"
fi
echo "Expected cache dir: $CACHE_DIR"
ls -la "$CACHE_DIR" 2>/dev/null || echo "Cache directory does not exist yet."

echo ""
echo "=== 2. Installing Chromium (and OS shared libs on Linux) ==="
npx -y playwright install chromium

if [[ "$(uname -s)" == "Linux" ]]; then
  echo "Linux detected: ensuring Chromium OS shared libraries are installed..."
  if command -v sudo >/dev/null 2>&1; then
    sudo npx -y playwright install-deps chromium
  else
    npx -y playwright install-deps chromium
  fi
fi

echo ""
echo "=== 3. Verifying Chromium binary & Playwright MCP CLI startup ==="
npx -y @playwright/mcp@latest --help | head -n 15

echo ""
echo "=== 4. Recommended Claude Code CLI registration (isolated headless chromium) ==="
echo 'claude mcp add playwright -- npx -y @playwright/mcp@latest --browser chromium --headless --isolated'

Before vs. After (Broken Pattern vs. Verified Fix)

Broken · Fragile Config (Assumes System Chrome + Unpinned Cache + Shared Profile Lock)
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest"]
    }
  }
}
// Fails if system Chrome is absent, Chromium revision bumped, or previous session locked profile
Verified · Hardened Config (Explicit Bundled Chromium + Headless + Isolated Profile)
# 1. Download matching Playwright Chromium binary (+ OS deps on Linux)
npx -y playwright install chromium

# 2. Configure explicit chromium browser & isolated ephemeral profiles in mcp.json
{
  "mcpServers": {
    "playwright": {
      "command": "/opt/homebrew/bin/npx",
      "args": [
        "-y",
        "@playwright/mcp@latest",
        "--browser",
        "chromium",
        "--headless",
        "--isolated"
      ]
    }
  }
}

Why this works: Passing --browser chromium uses Playwright’s managed binary instead of guessing system Chrome paths, --headless avoids display-server crashes in CI/remote SSH, and --isolated prevents SingletonLock collisions across parallel agent sessions.

Under the Hood

Why This Failure Happens in Real Pipelines

Microsoft’s @playwright/mcp server ships without bundled browser binaries so npm installs stay lightweight. By default, older and newer builds of @playwright/mcp either look for a system-installed Google Chrome binary (--browser chrome) or ask playwright-core to launch the exact Chromium revision pinned by its release inside ~/Library/Caches/ms-playwright (macOS) or ~/.cache/ms-playwright (Linux). If you develop on a machine with Brave, Arc, or Firefox instead of stock Google Chrome—or if npx @playwright/mcp@latest silently auto-upgraded overnight to a version expecting chromium-1169 while your cache only holds chromium-1148—the browser crashes immediately on launch.

On Linux workstations, WSL2, devcontainers, and CI runners, installing the Chromium binary via npx playwright install chromium is only half of the requirement. Headless Chromium links dynamically against native desktop libraries such as libnss3, libnspr4, libatk1.0, libgbm1, and libasound2. When those shared objects are absent, browserType.launch aborts with "Host system is missing dependencies to run browsers" even though the Chromium executable clearly exists on disk.

A third subtle failure affects multi-session coding agents: by default, Playwright MCP persists a shared browser profile directory across sessions. If a previous agent session crashed or remained open in another IDE window, the leftover SingletonLock file blocks new launches with a profile-in-use error. Switching to explicit --browser chromium --headless --isolated flags, downloading matching binaries with npx playwright install chromium (plus install-deps on Linux), and pinning a consistent PLAYWRIGHT_BROWSERS_PATH eliminates random browser launch failures permanently.

Step-by-Step Resolution & Verification

  1. 01

    Download Playwright’s managed Chromium binary and Linux system dependencies

    Run npx -y playwright install chromium on macOS/Windows—or npx -y playwright install --with-deps chromium on Ubuntu/Debian/Docker—so both full Chromium and chromium_headless_shell exist in your cache.

  2. 02

    Switch @playwright/mcp args to --browser chromium --headless --isolated

    Update .cursor/mcp.json or Claude Code’s MCP registration so Playwright MCP never searches for missing Google Chrome channels and never collides with a stale SingletonLock user-data directory.

  3. 03

    Verify PLAYWRIGHT_BROWSERS_PATH alignment and test a local screenshot call

    Confirm no conflicting PLAYWRIGHT_BROWSERS_PATH=0 variable points your IDE to an empty directory, restart your MCP host, and ask your agent to navigate to http://localhost:4321 and inspect the accessibility tree.

Verification Check · Confirm Managed Chromium Binary Exists & Launches Cleanly Without Errors
npx -y playwright --version && ls -d "$HOME/Library/Caches/ms-playwright"/chromium* "$HOME/.cache/ms-playwright"/chromium* 2>/dev/null
Expected healthy output:
Version 1.5x.x
/Users/<you>/Library/Caches/ms-playwright/chromium-11xx
/Users/<you>/Library/Caches/ms-playwright/chromium_headless_shell-11xx

How to Prevent This Error From Recurring

GUARDRAIL 01

Pin an explicit @playwright/mcp version in shared team repositories

Pinning a tested semver release instead of floating @latest stops silent overnight playwright-core bumps from demanding an undownloaded Chromium revision right before a launch.

GUARDRAIL 02

Always include --isolated for automated visual QA and multi-agent runs

Isolated ephemeral browser contexts start cleanly with zero leftover cookies, zero cached CSS, and zero SingletonLock crashes when two subagents audit pages back-to-back.

GUARDRAIL 03

Bake playwright install --with-deps chromium into Dockerfiles and devcontainers

Pre-installing Chromium and its Linux shared libraries at image build time guarantees instant visual QA startup with zero network downloads inside sandboxed environments.

Troubleshooting FAQs

Can I point Playwright MCP at my already-installed Google Chrome instead of downloading Chromium?
Yes. Pass --browser chrome (or --executable-path "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" on macOS) if corporate firewalls block Playwright’s CDN downloads, though managed Chromium gives more predictable headless version parity.
Why did npx playwright install succeed in Terminal, yet Cursor still says Executable doesn’t exist?
Your project’s local node_modules/playwright may be on a different revision than the globally cached npx @playwright/mcp@latest package. Check which chromium-XXXX folder the error message names and run npx -y playwright@<matching-version> install chromium, or run browser_install via MCP.
What is the difference between chromium and chromium_headless_shell in ms-playwright?
Newer Playwright releases use lightweight chromium_headless_shell by default in --headless mode while keeping full Chromium for headed windows. Running npx playwright install chromium downloads both automatically.
How do I fix "SingletonLock: File exists" or browser already-running errors in Playwright MCP?
Pass --isolated in your MCP args so each session launches a clean temporary profile, or pass a unique --user-data-dir path if you explicitly need persistent login state for local staging tests.
Does Playwright MCP need --headless when testing responsive 390px and 1440px layouts?
Headless mode renders identical Blink layout engines, web fonts, and CSS media queries while running faster and avoiding stolen window focus during autonomous visual QA loops; omit --headless only when you need to click through a login screen manually.
Use this page in AI tools or notes
raw .md