Skip to content

v0.20.1 breaks Electron apps: Target.getDevToolsTarget wasn't found #1197

@churnish

Description

@churnish

Description

v0.20.1 breaks all tool calls when connecting to Electron apps (e.g. Obsidian) via --browser-url. Every tool call fails with:

Protocol error (Target.getDevToolsTarget): 'Target.getDevToolsTarget' wasn't found

v0.20.0 works fine with the same setup.

Root cause

PR #1150 replaced the loop-based DevTools window detection with page.hasDevTools(), which calls Target.getDevToolsTarget — a CDP method that Electron's CDP implementation doesn't expose.

The call happens in McpContext.detectOpenDevToolsWindows() (line 475), which runs on every list_pages and page selection, making the entire MCP unusable.

Environment

  • chrome-devtools-mcp: 0.20.1
  • Electron: 39.7.0 (Chrome 142.0.7444.265)
  • App: Obsidian 1.12.4
  • Connection: --browser-url=http://127.0.0.1:9222

Workaround

Wrap the hasDevTools() call in a try-catch in build/src/McpContext.js:

try {
    if (await page.hasDevTools()) {
        mcpPage.devToolsPage = await page.openDevTools();
    } else {
        mcpPage.devToolsPage = undefined;
    }
} catch {
    // Target.getDevToolsTarget not supported (e.g. Electron)
    mcpPage.devToolsPage = undefined;
}

Expected behavior

list_pages and other tools should work with Electron apps that don't support Target.getDevToolsTarget, gracefully skipping DevTools window detection.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions