Skip to content

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

@asdlem

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", "https://github.com/home/xxx/tmp/chrome-devtools-mcp-wsl.log"]

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

    • chrome-devtools.new_page({ "url": "https://github.com/", "timeout": 60000 })
    • chrome-devtools.list_pages({})
  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",
"https://github.com/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

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