Skip to content

WSL2: auto-selects Windows chrome.exe under /mnt/c causing ECONNRESET and Target.setDiscoverTargets: Target closed #690

Closed

Description

@asdlem

Description of the bug

On WSL2 (Linux), when chrome-devtools-mcp is started without an explicit --executablePath, it may launch the Windows Chrome executable under /mnt/c/.../chrome.exe.
Shortly after launch, the CDP pipe connection resets (read ECONNRESET), and tool calls fail with:

Protocol error (Target.setDiscoverTargets): Target closed

If I force the Linux Chrome binary (e.g. --executablePath /usr/bin/google-chrome), the same tool calls work as expected.

Reproduction

  1. Configure the MCP server (no --executablePath) and enable a log file:
    command = "npx"
    args = ["-y", "chrome-devtools-mcp@latest", "--headless", "--isolated", "--logFile", "/home/xxx/tmp/chrome-devtools-mcp-wsl.log"]

  2. Start an MCP client (Codex CLI) and call:

  3. Observe failure:
    Protocol error (Target.setDiscoverTargets): Target closed

  4. Check /home/xxx/tmp/chrome-devtools-mcp-wsl.log. It shows:

    • Launching /mnt/c/Users/xxx/AppData/Local/Google/Chrome/Application/chrome.exe ...
    • read ECONNRESET / ConnectionClosedError / TargetCloseError

Expectation

On Linux/WSL, if a Linux Chrome binary is available (e.g. /usr/bin/google-chrome), default executable selection should prefer it.
At minimum, if a Windows .exe under /mnt/c is selected, the server should emit a clear warning explaining this is likely to break CDP and recommend using --executablePath.

MCP configuration

[mcp_servers.chrome-devtools]
command = "npx"
args = [
"-y",
"chrome-devtools-mcp@latest",
"--headless",
"--isolated",
"--logFile",
"/home/xxx/tmp/chrome-devtools-mcp-wsl.log",
]
startup_timeout_sec = 30.0

Chrome DevTools MCP version

0.12.1

Chrome version

Linux Chrome: Google Chrome 143.0.7499.109 Windows Chrome: /mnt/c/Users/xxx/AppData/Local/Google/Chrome/Application/chrome.exe (seen in log)

Coding agent version

codex-cli 0.73.0

Model version

gpt-5.2 (reasoning: high)

Chat log

I can attach: - /home/xxx/tmp/chrome-devtools-mcp-wsl.log Key excerpts include: - the "Launching ..." line showing /mnt/c/.../chrome.exe - read ECONNRESET - TargetCloseError stack trace

Node version

v24.11.1

Operating system

Linux

Extra checklist

  • I want to provide a PR to fix this bug

Activity

  1. added theissue type on Dec 17, 2025
  2. asdlem commented on Dec 17, 2025

    @asdlem
    Author

    Here is how I diagnosed and worked around the issue:

    Root cause (confirmed via server log):

    • On WSL2 (Linux), when chrome-devtools-mcp is started without an explicit --executablePath, it auto-selected and launched the Windows Chrome binary (path like /mnt/c/.../chrome.exe).
    • The server then used CDP over --remote-debugging-pipe, but the connection was reset (read ECONNRESET), and tool calls failed with:
      Protocol error (Target.setDiscoverTargets): Target closed

    Workaround:

    1. Force the Linux Chrome executable:
      --executablePath "/usr/bin/google-chrome"

    2. In headless / constrained environments (WSL/containers), also add:
      --chromeArg "--no-sandbox"
      (optional: --isolated to use a temporary profile)

    After applying the workaround:

    • chrome-devtools.list_pages returned a valid list
    • chrome-devtools.new_page / navigate_page worked
    • chrome-devtools.take_snapshot returned a normal accessibility tree snapshot

    Before (problematic on WSL2): no explicit --executablePath

    [mcp_servers.chrome-devtools]
    command = "npx"
    args = [
    "-y",
    "chrome-devtools-mcp@latest",
    "--headless",
    "--isolated"
    ]
    startup_timeout_sec = 30.0

    After (workaround): force Linux Chrome on WSL2 + no-sandbox

    [mcp_servers.chrome-devtools]
    command = "npx"
    args = [
    "-y",
    "chrome-devtools-mcp@latest",
    "--headless",
    "--executablePath",
    "/usr/bin/google-chrome",
    "--chromeArg",
    "--no-sandbox"
    ]
    startup_timeout_sec = 30.0

    Optional (debug only): enable server log file / DEBUG

    [mcp_servers.chrome-devtools]
    command = "npx"
    args = [
    "-y",
    "chrome-devtools-mcp@latest",
    "--headless",
    "--isolated",
    "--logFile",
    "/tmp/chrome-devtools-mcp.log"
    ]
    [mcp_servers.chrome-devtools.env]
    DEBUG = "*"

  3. huihui43 commented on Jan 15, 2026

    @huihui43

    work for me, thanks!

  4. LiCeline commented on Feb 9, 2026

    @LiCeline

    Here is how I diagnosed and worked around the issue:

    Root cause (confirmed via server log):

    • On WSL2 (Linux), when chrome-devtools-mcp is started without an explicit --executablePath, it auto-selected and launched the Windows Chrome binary (path like /mnt/c/.../chrome.exe).
    • The server then used CDP over --remote-debugging-pipe, but the connection was reset (read ECONNRESET), and tool calls failed with:
      Protocol error (Target.setDiscoverTargets): Target closed

    Workaround:

    1. Force the Linux Chrome executable:
      --executablePath "/usr/bin/google-chrome"
    2. In headless / constrained environments (WSL/containers), also add:
      --chromeArg "--no-sandbox"
      (optional: --isolated to use a temporary profile)

    After applying the workaround:

    • chrome-devtools.list_pages returned a valid list
    • chrome-devtools.new_page / navigate_page worked
    • chrome-devtools.take_snapshot returned a normal accessibility tree snapshot

    Before (problematic on WSL2): no explicit --executablePath

    [mcp_servers.chrome-devtools] command = "npx" args = [ "-y", "chrome-devtools-mcp@latest", "--headless", "--isolated" ] startup_timeout_sec = 30.0

    After (workaround): force Linux Chrome on WSL2 + no-sandbox

    [mcp_servers.chrome-devtools] command = "npx" args = [ "-y", "chrome-devtools-mcp@latest", "--headless", "--executablePath", "/usr/bin/google-chrome", "--chromeArg", "--no-sandbox" ] startup_timeout_sec = 30.0

    Optional (debug only): enable server log file / DEBUG

    [mcp_servers.chrome-devtools] command = "npx" args = [ "-y", "chrome-devtools-mcp@latest", "--headless", "--isolated", "--logFile", "/tmp/chrome-devtools-mcp.log" ] [mcp_servers.chrome-devtools.env] DEBUG = "*"

    OMG , it helps me!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions